in reply to Re: Regex AND NOT with zero-width negative lookahead assertion
in thread Regex AND NOT with zero-width negative lookahead assertion

Thanks. (And thanks to those below, too.)

That seems to achieve the desired results, if I escape the pound sign (#) there. Otherwise that gets interpreted as a comment.

  • Comment on Re^2: Regex AND NOT with zero-width negative lookahead assertion

Replies are listed 'Best First'.
Re^3: Regex AND NOT with zero-width negative lookahead assertion
by hippo (Archbishop) on Mar 25, 2020 at 13:43 UTC

    How odd. It works fine exactly as posted for me in Perl 5.20.3. Which Perl version are you using which requires the escape?

    Update: also tested successfully on v5.10.1, v5.16.3, v5.26.1 and v5.30.0.

      I believe this works everywhere; certainly does on 5.8. What *doesn’t* work a lot of the time is syntax highlighting and autoformatting. I end up escaping them sometimes just so I don’t have to deal with that; in certain codebases/c?perl-modes at least.

      The  m, ... ,x match in the OPed code uses the  /x whitespace/comments modifier; your match does not. (Update: I presume mldvx4 is still using the  /x modifier.)


      Give a man a fish:  <%-{-{-{-<