Skip to content Skip to sidebar Skip to footer

Android - Php - Regex With Letters Of All Languages

Following my android code: string.matches('[a-zA-Z ]+') How to allow letters of all languages (and spaces)? How to do it with also with PHP function preg_match()?

Solution 1:

You can use Unicode property \p{L} which matches any kind of letter from any language.

[\\p{L} ]+

You can use it like so with PHP's preg_match() function:

preg_match('/^[\p{L} ]+$/u', $str, $match);

Post a Comment for "Android - Php - Regex With Letters Of All Languages"