Created
February 16, 2012 14:43
-
-
Save daGrevis/1845355 to your computer and use it in GitHub Desktop.
Regex for i18n name with spaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $regex = '/^\pL+( \pL+)*$/uD'; | |
| $values = array( | |
| 'John Smith', | |
| 'Jānis Bērziņš', | |
| 'Hack3r', | |
| 'I like periods.', | |
| ); | |
| foreach ($values as $value) { | |
| var_dump((boolean)preg_match($regex, $value)); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: