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

Re: [FWP] Comparing Regular Expressions



On Tue, Sep 07, 1999 at 07:54:26PM -0400, Bill Jones wrote:
> > 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 not true.  What the first one matches is just about
> everything, except a newline;

Exactly.  Any string which is matched by the latter regex will also be
matched by the former regex.


> note that you don't need q// - which
> I believe you've just turned your expression into '.*' - when a
> simple /.*/ would do.

Given two regexes, /a/ and /b/, how would you compare them?
In order to compare them, you probably want them as strings,
i.e. q/a/ and q/b/.


Ronald

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