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

Top Page

Reply to this message
Author: admin
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 2158] PCRE2 10.30 doesn't accept some regular expressions with character classes anymore
https://bugs.exim.org/show_bug.cgi?id=2158

Petr Pisar <ppisar@???> changed:

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


--- Comment #1 from Petr Pisar <ppisar@???> ---
This reduces to /[\w-_]/:

$ pcre2test
PCRE2 version 10.30 2017-08-14
re> /[\w-_]/

Failed: error 150 at offset 3: invalid range in character class
re>


The error is fine because you try to make a range where the left side is not a
single code point but a set of characters (\w). Perl also raises a warning on
these expressions:

$ perl -w -e '/[\w-_]/'
False [] range "\w-" in regex; marked by <-- HERE in m/[\w- <-- HERE _]/ at -e
line 1.
Use of uninitialized value $_ in pattern match (m//) at -e line 1.

The expression is ill. You need to escape the hyphen character.

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