[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] Comparing Regular Expressions



I don't know if I've somehow been thrown off, or everyone just has
a Perl hangover. And I am not even sure if this is just another
do-my-homework question, but:

Is there a way to "compare" regular expressions? For instance,
q/.*/ is less than q/a.*/ because whatever matches the latter
also matches the former. Is there an easy way to do such a
comparison?

That's perhaps intractable, but at least well defined. Now
a more interesting question: if a string is known to match
two REs, then is there a sense in which one of the matches
is "better", i.e. more specialized? How do you go about
defining it? (If a string matches q/a.*/ that's intuitively
more information than q/.*/.)

I'll just go with length of the RE, sense be damned. But
better ideas are appreciated,

Tushar


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe