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)/;
In reply to Re: Regex: return the pattern instead of the actual match
by rovf
in thread Regex: return the pattern instead of the actual match
by Deus Ex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |