PCRE2Project / pcre2

PCRE2 development is now based here.
Other
918 stars 191 forks source link

Perl compat issue: correct scan-ahead for trailing hyphen #538

Closed NWilson closed 3 weeks ago

NWilson commented 1 month ago

I have added a TODO to the code, but I didn't want to fix it (unnecessarily) in the same PR as the extended character classes.

If you have: [\d-] it's considered OK, because the hyphen is at the end of the class.

Perl also accepts these cases: [\d-\Q\E] and /[\d- ]/xx, but PCRE2 rejects them due to insufficient lookahead when checking "is the hyphen at the end of the character class".