in reply to Regex: return the pattern instead of the actual match
if (m/($regex)/) { print $regex; } [download]
prints the pattern that matched the text in $1.
But why would you want that? It might be an XY Problem, and a better solution might exist.