[pcre-dev] [Bug 2770] New: Delimiters used within \Q..\E are…

Top Pagina
Delete this message
Auteur: admin
Datum:  
Aan: pcre-dev
Onderwerp: [pcre-dev] [Bug 2770] New: Delimiters used within \Q..\E are marked unrecognized
https://bugs.exim.org/show_bug.cgi?id=2770

            Bug ID: 2770
           Summary: Delimiters used within \Q..\E are marked unrecognized
           Product: PCRE
           Version: 10.34 (PCRE2)
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: Philip.Hazel@???
          Reporter: onlinecop@???
                CC: pcre-dev@???


If a regex delimiter is encountered within a \Q..\E block, it should be
recognized as a literal character, not as a delimiter. Below, I have specified
4 math operators: [-+*/]. Since my delimiter is a forward-slash, I started the
character group, then used \Q, then entered the raw (unescaped) math
characters, then used \E, and finally closed the character group.

PCRE2 version 10.34 2019-11-21
re> /[\Q-+*/\E]/g

** Unrecognized modifier 'E' in 'E]/g'
re> /[\Q-+*\/\E]/g
data> a+b-c/d*e\\f

0: +
0: -
0: /
0: *
0: \
data>
re> @[\Q-+*/\E]@g
data> a+b-c/d*e\\f

0: +
0: -
0: /
0: *
data>

You notice that pcre2test gives an error when attempting to use the delimiter
within \Q..\E, but accepted the pattern when I escaped it as: [-+*\/]

However, the matched string now matches the backslash character in the data,
which is not desired.

If the delimiter is changed, then the raw [-+*/] characters are accepted, and
the backslash character is not matched.

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