^(?![_\.\'\-])(?:[\p{L} ]+)$
If I understand correctly, there is:
(?![_\.\'\-])a negative lookahead, that is the string cannot start with underscore, point, apostrophe or minus sign (any number of).(?:[\p{L} ]+)allowing at least one character in Ll, Lm, Lo, Lt and Lu and spaces.
First question is: something like “1Bob” should not fail (because of the lookahead). So why it fails?
Second question is where I can find a list or explanation of characters in Ll, Lm, Lo, Lt and Lu?
The digit
"1"is not matched by\p{L}(this matches only letters!). If you want to match any (numeric) digit, use the class\p{N}as well:which will print:
Also, there are small differences between Ruby’s regex engine and that of PHP. Since your target language seems to be PHP, I recommend testing it with PHP, not with Rubular (Ruby).
Note that inside character classes, the “normal” regex meta chars don’t have any special powers and need not be escaped:
preg_match("/^(?![_.'-])(?:[\p{N}\p{L} ]+)$/u", $text)An overview of many Unicode Character Properties/Classes can be found here: http://www.regular-expressions.info/unicode.html