http://www.perlmonks.org?node_id=31468


in reply to codem/(?:-x pattern) #comment /x bug?/code

Tried your code with perl 5.6 (activestate build), and it works like a champ.

Output: PATTERN=m/(?-x:(abcdef))/x ANSWER = abcdef PATTERN=m/(?-x:(abcdef)) # comment here/x ANSWER = abcdef

Cheers,
Shendal

Replies are listed 'Best First'.
RE: RE: codem/(?:-x pattern) #comment /x bug?/code
by Fastolfe (Vicar) on Sep 08, 2000 at 00:15 UTC
    I tried this with 5.00551 on Solaris 2.6 (egcs 2.91.57) and it failed on the 2nd pattern like the original poster. At first it seemed like the (?-x:...) bit was negating the x flag for the entire regexp, but I tried adding the comment to the pattern and it still failed to match, so I'm not sure. Very odd.

    Like another poster, I was thinking that the end of the regexp being on the same line as the comment was causing the /x to be ignored (interpreted as part of the comment), but adding whitespace in there caused the pattern to fail in both cases (odd). Something isn't right.

RE: RE: codem/(?:-x pattern) #comment /x bug?/code
by dcorbin (Sexton) on Sep 08, 2000 at 00:13 UTC
    Sounds like a bug that's been fixed then.