[pcre-dev] [Bug 1619] zero-width negative lookahead with cap…

Top Page
Delete this message
Author: Zoltan Herczeg
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1619] zero-width negative lookahead with capture not working
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1619

Zoltan Herczeg <hzmester@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hzmester@???





--- Comment #3 from Zoltan Herczeg <hzmester@???> 2015-04-23 20:43:24 ---
Unset capture can match with PCRE2_MATCH_UNSET_BACKREF option. But your pattern
match for some other reasons. This is a simplified form:

/(ba)a(?!(a)x)\2(baac)/ matches baaabaac

Normally, when (a)x does not match, pcre should backtrack and during backtrack
(a) should be reverted to empty match. This does not happen.

This pattern does not match in JavaScript.

/(ba)a(?!(a)x)\2(baac)/.exec("baaabaac") returns NULL.

Interestingly, if I add a | the pattern does not match in PERL as well:

/(ba)a(?!(a)x|)\2(baac)/ does not match baaabaac
/(ba)a(?!|(a)x)\2(baac)/ does not match baaabaac

I suspect the first case is special cased in Perl in some way. Or this is just
a bug.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email