http://www.perlmonks.org?node_id=531685


in reply to Re^2: Testing regex equivalence
in thread Testing regex equivalence

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

/(?:.*).*$/ # and /.*$/

you could convert them into canonical form, that is, normalize all .* to become (?:.*), and then simplify, mapping (?:.*)(?:.*) to (?:.*).