On Friday 27 August 2004 HH:21:13, Chris Devers wrote: > On Fri, 27 Aug 2004, Mark Maunder wrote: > > I've google'd and CPAN'd and no luck. Is there a tool out there that > > will generate a regular expression based on a series of string inputs > > that are similar but have parts that differ[?] > [..] > > My hunch is that flinging a bunch of text at some kind of regex maker > and telling it to figure out on its own how to match or not match > different examples is going to be a variant of the halting problem. > > <http://en.wikipedia.org/wiki/Halting_problem> > <http://mathworld.wolfram.com/HaltingProblem.html> > > And I'd be stunned if you could solve that by the end of the day :-)
Hi Chris, thanks for those links - that's quite interesting. I'm not sure if I understood the Halting Problem completely, but could you give a hint what brings you to the assumption that "automatically generating regular expressions from a bunch of text" is a variant of the Halting Problem? I'm facing a roughly similar problem at the moment, and I was planning on using String::Compare or something like it for comparing strings char by char. Taking a first glance at the code, it doesn't look too hard to modify it in a way that it returns not only the similarity between two strings, but also a string with special characters at those places that are different - something that I could call like: my $a = 'abcdXef'; my $b = 'abcdYef'; my ($similarity, $regexp) = compare_strings($a, $b); and would return the similarity as percentile of matching chars (6/7 in this case) and a regex that looks like abcd.ef Is this problem different to the one you were talking about? If not, why shouldn't it be solvable? Philipp -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>