\Q interpretation is not done by the regex engine, but by string interpolation. Except you add the \Q in a single quote string, so the interpolation does not happen, and the \Q and \E are still there for the regex engine to read, though they don't have meaning in a regex. If you want to pre-process a string so that its special chars are excaped, you can use quotemeta, which is what \Q does implicitly. my $pref = "^".quotemeta($1);
In reply to Re: Q regex escape within variable
by Eily
in thread Q regex escape within variable
by palkia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |