in reply to Non-capturing zero-width negative lookahead

The (?! is noncapturing as is.

However you have included a (:?, the colon depicts an (unrecognized) regexp extensionis not a metacharacter so this is treated as a regular capturing group.

Updated: clarified my statement, Sidhekin is right

  • Comment on Re: Non-capturing zero-width negative lookahead

Replies are listed 'Best First'.
Re^2: Non-capturing zero-width negative lookahead
by Sidhekin (Priest) on Mar 22, 2007 at 16:50 UTC

    the colon depicts an (unrecognized) regexp extension

    No, it doesn't. The colon is a literally matching atom, and the question mark is a quantifier. With some hopefully clearer /x spacing:

    $foo =~ /( ( :? . # 0 or 1 colon + 1 non-newline char | # or \n (?! \n\n) # 1 newline not followed by two more newlin +es )+ ) /x

    print "Just another Perl ${\(trickster and hacker)},"
    The Sidhekin proves Sidhe did it!