[pcre-dev] [Bug 2326] New: Inconsistent results with backref…

トップ ページ
このメッセージを削除
著者: admin
日付:  
To: pcre-dev
題目: [pcre-dev] [Bug 2326] New: Inconsistent results with backreference setting in negative lookarounds used as conditions
https://bugs.exim.org/show_bug.cgi?id=2326

            Bug ID: 2326
           Summary: Inconsistent results with backreference setting in
                    negative lookarounds used as conditions
           Product: PCRE
           Version: 8.42
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: tattarakis@???
                CC: pcre-dev@???


Another bug I came across recently..

The docs state that backreferences are set in negative lookaheads only when
used as the condition in a conditional subpattern, which does indeed seem
logical. However, I'm not observing that happening consistently, and can only
force the behaviour in certain circumstances:

re: "^(?(?!(a))|a){1}"
str: "abc"

The above does not set \1.

re: "^(?(?!(a))|a){2}"
str: "abc"

This sets \1. It is not until the conditional subpattern takes a "yes" route
that the backreference becomes set.

And some odd behaviour: introducing an empty lookahead to the above prevents \1
from being set:

re: "^(?(?!(a))|(?=)a){2}"
str: "abc"

Difficult come, easy go :P

Once again, sorry if PCRE2 targets this issue.

Best,
John Tattarakis

--
You are receiving this mail because:
You are on the CC list for the bug.