[\s'-]: A space (\s), apostrophe ('), or hyphen (-).
[A-Za-zÀ-ÿ\u0400-\u04FF\u0530-\u058F\u0370-\u03FF\u0590-\u05FF\u0600-\u06FF\u0900-\u097F\u4E00-\u9FFF]+: One or more valid letters from the supported languages.
This allows for compound names with spaces, apostrophes, or hyphens (e.g.,
Jean-Luc, O'Connor, Mary Jane).
4. $ (End of the string)
Ensures the match goes to the end of the string.
Key Features
It supports multiple languages, Including Latin, Cyrillic, Greek, Hebrew, Arabic, Devanagari, and Chinese scripts.
Allows separators: Supports names with spaces, hyphens, and apostrophes (e.g.,
Mary-Jane, O'Neill).
Ensures validity: Names must start and end with a valid letter, disallowing extra spaces or invalid characters.
Examples of Valid Names
Jean-Luc (Hyphenated name in Latin script)
O'Connor (Name with apostrophe)
张伟 (Chinese characters)
Алексей Иванов (Cyrillic name with a space)
محمد علي (Arabic name with a space)
राम श्याम (Devanagari name with a space)
Examples of Invalid Names
John@Doe (Contains an invalid character @)
Jean--Luc (Multiple consecutive hyphens)
Zhang (Leading space)
John (Trailing space)
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Explanation:
1.
^(Start of the string)2.
[A-Za-zÀ-ÿ\u0400-\u04FF\u0530-\u058F\u0370-\u03FF\u0590-\u05FF\u0600-\u06FF\u0900-\u097F\u4E00-\u9FFF]+A-Za-z: Latin alphabets (both uppercase and lowercase).À-ÿ: Latin-based alphabets with diacritics (e.g.,é,ñ, etc.).\u0400-\u04FF: Cyrillic characters.\u0530-\u058F: Armenian characters.\u0370-\u03FF: Greek characters.\u0590-\u05FF: Hebrew characters.\u0600-\u06FF: Arabic characters.\u0900-\u097F: Devanagari characters (used in Hindi and other Indian languages).\u4E00-\u9FFF: Chinese characters.This section ensures the name can start with letters from supported languages.
3.
(?:[\s'-][A-Za-zÀ-ÿ\u0400-\u04FF\u0530-\u058F\u0370-\u03FF\u0590-\u05FF\u0600-\u06FF\u0900-\u097F\u4E00-\u9FFF]+)*(?: ... ):[\s'-]: A space (\s), apostrophe ('), or hyphen (-).[A-Za-zÀ-ÿ\u0400-\u04FF\u0530-\u058F\u0370-\u03FF\u0590-\u05FF\u0600-\u06FF\u0900-\u097F\u4E00-\u9FFF]+: One or more valid letters from the supported languages.4.
$(End of the string)Key Features
Mary-Jane,O'Neill).Examples of Valid Names
Jean-Luc(Hyphenated name in Latin script)O'Connor(Name with apostrophe)张伟(Chinese characters)Алексей Иванов(Cyrillic name with a space)محمد علي(Arabic name with a space)राम श्याम(Devanagari name with a space)Examples of Invalid Names
John@Doe(Contains an invalid character@)Jean--Luc(Multiple consecutive hyphens)Zhang(Leading space)John(Trailing space)