Last active
March 14, 2019 16:01
-
-
Save stgogm/32b54c4a5d00e73dedb2 to your computer and use it in GitHub Desktop.
Person's name RegExp
This file contains 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
/^([a-z\u00C0-\u02AB'´`]{1,}\.?\s?)([a-z\u00C0-\u02AB'´`]?\.?\s?)+$/i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, your regex worked pretty well for me amongst others and thus I wanted to thank you; I only have one problem, how can I avoid a single quote character (') to pass the regex?
-Edit:
I've done some research since I'm not so experienced with regex and I think I solved some problems for me with this modified version:
/^((?!.*[\u00D7\u00F7\u01C0-\u01C3])[a-z\u00C0-\u02AF´
]{1,}\s?)((?!.*[\u00D7\u00F7\u01C0-\u01C3])[a-z\u00C0-\u02AF'´
]?\s?)+$/i;I have excluded the special caracters × ÷ ǀ ǁ ǂ ǃ that where inside the range of unicode 00C0-02AB, I've extended the latter range until 02AF to match the end of the unicode group and I've removed the single quote character form the first word (in this way I've resolved the case of a single quote passing the regex but for someone may not be good because it blocks the names starting with a single quote).
Regards.