[pcre-dev] [Bug 2725] (*SKIP)(*F) within a (?(DEFINE)) does …

Página superior
Eliminar este mensaje
Autor: admin
Fecha:  
A: pcre-dev
Asunto: [pcre-dev] [Bug 2725] (*SKIP)(*F) within a (?(DEFINE)) does not skip position
https://bugs.exim.org/show_bug.cgi?id=2725

onlinecop@??? changed:

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


--- Comment #1 from onlinecop@??? ---
When /(*SKIP)(*F)/ is used outside of a (?(DEFINE)...) group, the bumpalong
moves to the location where (*SKIP) was encountered. Given the pattern:

/(?<Value>"[^"]*":(*SKIP)(*F)|"[^"]*")/g

on the literal text:

"key": { "k1":"v1", "k2":"v2" }

(or on the escaped text):

"\"key\": { \"k1\":\"v1\", \"k2\":\"v2\" }"

then both PCRE2 and perl return this output:

["\"v1\"","\"v2\""]

However, if that same pattern is moved into a (?(DEFINE)...) block like this:

/((?&Value))(?(DEFINE)(?<Value>"[^"]*":(*SKIP)(*F)|"[^"]*"))/g

The results in PCRE2 are:

["\": { \"","\":\"","\", \"",":"]

The results in perl are:

["\"v1\"",undef,"\"v2\"",undef]

Instead of (*SKIP) moving the bumpalong position when it failed within the
(?(DEFINE)...) group, it moved to the next text position and tried to match
again.

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