BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
I've discovered a peculiarity, which may be a bug but I'm not sure yet. It affects AS 802 (5.8.0), but not AS 633.
If you try to use an escaped # in a regex using qr//x, it embeds a newline in the compiled regex. As you can see, I tried various methods of escaping the # to no avail.
#! perl -slw use strict; my $re_a = qr[\w+\#]; my $re_b = qr[\w+ \# ]x; my $re_c = qr[\w+ [#] ]x; my $re_d = qr[\w+ \Q#\E ]x; print $re_a; print $re_b; print $re_c; print $re_d; __END__ (?-xism:\w+\#) (?x-ism:\w+ \# ) (?x-ism:\w+ [#] ) (?x-ism:\w+ \#\\E\ )
I think this is a bug, as it appears to be trying to match a \n at that position, but I'm having trouble confirming this. Any ideas how to verify this is the case?
Also, does this affect non-AS builds of 5.8?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: qr//x and \# weirdness (AS 5.8?)
by Chmrr (Vicar) on May 28, 2003 at 05:28 UTC | |
by BrowserUk (Patriarch) on May 28, 2003 at 06:06 UTC | |
Re: qr//x and \# weirdness (AS 5.8?)
by PodMaster (Abbot) on May 28, 2003 at 04:40 UTC | |
by BrowserUk (Patriarch) on May 28, 2003 at 05:27 UTC | |
Re: qr//x and \# weirdness (AS 5.8?)
by Enlil (Parson) on May 28, 2003 at 04:59 UTC | |
by BrowserUk (Patriarch) on May 28, 2003 at 05:15 UTC | |
Re: qr//x and \# weirdness (AS 5.8?)
by tedrek (Pilgrim) on May 28, 2003 at 04:56 UTC | |
Re: qr//x and \# weirdness (AS 5.8?)
by djantzen (Priest) on May 28, 2003 at 04:43 UTC |