Using the eval works great for matches : $pattern = eval "qr$pattern" or die $@;
in reply to Re: qr// and user provided regex patterns...
in thread qr// and user provided regex patterns...
But of course, when I do a 'substitution pattern' s///, it fails because it looks like eval "qrs/stuff/morestuff/.
So I tried adding a bang, to wrap around the interpolated variable in the original : $pattern = eval "qr!$pattern!" or die $@;
But now my patterns fail to match anything. Example:
s/Bill Clinton/The ex-President/gi on Bill Clinton is the ex-President
+. bill clinton. results in Failure.