The range of character classes is determined by - between two values ββin a character class ( [] in a regular expression). [0-9] means everything between 0 and 9 inclusive. In the regular expression in your code, you have several ranges of character classes, az , 0-9 . There is also one class that you probably did not want to specify, namely _-\s .
"/^[a-z0-9]([0-9a-z_-\s])+$/i" ^^^^
This, apparently, is not considered an invalid character range in some (most?) Versions of PCRE (using the PHP regular expression library), but recently it can be changed, and if the PCRE library was updated on the server, it could be cause.
Debuggex is a good tool that can help debug errors (well, the error message from PHP told you both the line and the symbol where the error was, so ..) like this (I'm not affiliated, just a fan).
Matslindh
source share