in reply to How to find where regex did not match across the line

You could execute code after each sub-regex that matters and matched using the (?{...}) construct.

But be careful to avoid code regex-optimization,

DB<6> "ab" =~ /(a)(?{print "match1"}).{0}(b)(?{print "match2"})/ match1match2 DB<7> "axb" =~ /(a)(?{print "match1"}).{0}(b)(?{print "match2"})/ match1

see perlretut for details for why I try to avoid optimization with a attempted match of a ("useless") zero length dot .{0}

Cheers Rolf