Think about Loose Coupling | |
PerlMonks |
Re^3: Testing regex equivalenceby Corion (Patriarch) |
on Feb 21, 2006 at 13:19 UTC ( [id://531685]=note: print w/replies, xml ) | Need Help?? |
They aren't strictly equivalent, because the first regex has capturing parentheses even if they only will ever match the empty string at the end of the string. But assuming you have
you could convert them into canonical form, that is, normalize all .* to become (?:.*), and then simplify, mapping (?:.*)(?:.*) to (?:.*).
In Section
Seekers of Perl Wisdom
|
|