in reply to qr/string/ is not the same as qr/$var/ ?
At this point, the only way out of this conundrum that I can see is to either hand parse the pattern (erk) or use a Safe compartment (re-erk).Well, for starters, the user doesn't really benefit from \U or \L - it only requires the user to type more characters. For \Q, one could consider adding a flag to the program - if the flag is given, the string should be searched for as is (that is, as if \Q was prepended at the start of the search string), or else, as a regex (kind of like the -F option for (GNU) grep). Else, you can always use something like:
s{\G([^\\]*(?:\\[^Q][^\\]*)*) \\Q ([^\\]*(?:\\[^E][^\\]*)*) (?:\\E|$)} {$1\Q$2}gx;
|
|---|