I want to understand the following pattern, step by step.
/\p{L}/u
/u is a modifier (http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php):
u (PCRE8)
This modifier turns on additional functionality of PCRE that is incompatible with Perl. > Pattern strings are treated as UTF-8. This modifier is available from PHP 4.1.0 or greater > on Unix and from PHP 4.2.3 on win32. UTF-8 validity of the pattern is checked since PHP > 4.3.5.
And what about the rest?
Thank you.
Check the PHP documentation about escape sequences to find out about
\p{xx}, then Unicode character properties to find out what\p{L}does.To elaborate:
umodifier makes it possible to use Unicode escape sequences\p{xx}is a Unicode sequence with a certain property\p{L}is a Unicode sequence that matches a letterTherefore,
/\p{L}/umatches Unicode letters.