[pcre-dev] [Bug 2158] PCRE2 10.30 doesn't accept some regula…

Top Page

Reply to this message
Author: admin
To: pcre-dev
Subject: [pcre-dev] [Bug 2158] PCRE2 10.30 doesn't accept some regular expressions with character classes anymore

Philip Hazel <ph10@???> changed:

           What    |Removed                     |Added
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #2 from Philip Hazel <ph10@???> ---
Petr is absolutely right. PCRE2 does not have a warning mode like Perl, so I
felt it best to give an error because this is likely to be a user error. If you
want to include a hyphen in a class, it's best to put it first or last (or, as
Petr says, escape it). The pcre2pattern documentation says this:

"Perl treats a hyphen as a literal if it appears before or after a POSIX class
(see below) or before or after a character type escape such as as \d or \H.
However, unless the hyphen is the last character in the class, Perl outputs a
warning in its warning mode, as this is most likely a user error. As PCRE2 has
no facility for warning, an error is given in these cases."

In other words, it's a documented feature. I'm sorry you have been caught, but
I think it's better to err on the side of strictness.

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