in reply to Regex: return the pattern instead of the actual match
I don't know why you want to do this, but if you store the Regexp as a string, you allready have the pattern:
Now, matched part of the $_ is in $1 and the pattern corresponding to this, is in $regex.my $regex = 'foo\\d+|bar\S+?'; ... m/($regex)/;
|
|---|