![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: creating qr from existing regexby bart (Canon) |
on Feb 09, 2018 at 18:18 UTC ( #1208848=note: print w/replies, xml ) | Need Help?? |
Remove the slashes, extract the modifier ("i") (say, in a variable $flags). Keep the core of the regex as a string, in your example that would be .*uba$.
Then put "(?$flags:" in front of it, and ")" behind it. You can use that string ($re) directly as a regex:
You can also turn it into a regex object:
In Section
Seekers of Perl Wisdom
|
|