This is my error which seems related to a server upgrade.
preg_match(): Compilation failed: invalid range in character class
// The regex that did not compile
return preg_match("/^[\.\pL-0-9'\s]+$/u", $value);
I cannot see the issue and have not found clear documentation on which chars now may need to be escaped.
PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 10.32 2018-09-10
PCRE Unicode Version => 11.0.0
php 7.3.17
You can't have a range with unicode properties, the error comes from the hyphen between \pL
and 0
. Some implementations of PCRE accept it as a hyphen some other don't.
Just remove it or, if you want to match hyphen, escape it or put it at the beginning or at the end of the character class:
[.\pL0-9'\s]
or
[.\pL\-0-9'\s]
or
[-.\pL0-9'\s]
or
[.\pL0-9'\s-]