Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Now I'm just guessing, but it seems to me that what they want is the text that most closely corresponds to a given action. The concern is the text, not the regex. Since I haven't seen the data you work with, this might be way off base, but perhaps a better way would be to find all regexes that will match with the text and then choose the text with the smallest "edit distance" against a target text? Edit distance is generally concerned with the number of additions, deletions and substitutions necessary to transform one string into another. There are a number of CPAN modules which can calculate this for you. See Text::LevenshteinXS for a representative example. Cheers, New address of my CGI Course. In reply to Re: Most specific pattern (edit distance)
by Ovid
|
|