in reply to Re: Unrecognized escape \Q passed through in regex
in thread Unrecognized escape \Q passed through in regex
\Q and \E don't work inside interpolations. They only work in regexp literalsFascinating theory, but easily proven wrong:
The truth is that \Q means "add backslashes to special chars until \E" in the exact same places that \n becomes a newline and $x expands to its value: every double-quoted string. A regex (that doesn't have special single-quote quoting) is just one example of that.print "\Qabc*def\E\n"; # prints abc\*def
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Unrecognized escape \Q passed through in regex ('interpolations")
by tye (Sage) on Jan 27, 2006 at 04:00 UTC | |
Re^3: Unrecognized escape \Q passed through in regex
by ikegami (Patriarch) on Jan 27, 2006 at 05:21 UTC |
In Section
Seekers of Perl Wisdom