in reply to Re: Weird quoting with /x modifier
in thread Weird quoting with /x modifier
>> Note the addition of the "\E" at the end of the first explanation, but not the second.
This is exactly what bothering me. As far as I understand \Q and \E is just syntactic sugar, to avoid typing dozens of escapes. So neither \Q nor \E should appear in compiled regular expression.
Regarding your excerpt from perlre: it is not my case. I'm intentionally quoting #.
The "#" character is also treated as a metacharacter introducing a comment, just as in ordinary Perl code. This also means that if you want real whitespace or "#" characters in the pattern (outside a character class, where they are unaffected by "/x"), then you'll either have to escape them (using backslashes or "\Q...\E") or encode them using octal or hex escapes.
By the way hex escapes not working inside /\Q...\E/ for me. I worked around my problem replacing /\Q...#...\E/x with /\Q...\E\#\Q...\E/x.
Thank you for your answer!
|
|---|