in reply to Re: Re: (FoxUni) Re: generating regexes?
in thread generating regexes?

Other possibilities for scoring that we've throught about are: the length of the match - regexes that match more of an example are scored higher, and specificity - regexes that are more specific are scored higher (qr/^[A-Z]{2}$/ is more specific than qr/^\w+$/, qr/^.+$/ is so non-specific, that we don't even consider it valid).

Of course, this points out another weakness in the approach the example code uses - it only considers left-anchored regexes, so it tends not to notice commonalities on the right hand side (or anywhere else in the data for that matter).

I'm not saying we've got the problem solved, or that it's even tractable in the general case. We just have an approach that works for some cases.