Created
September 1, 2019 09:34
-
-
Save heinthanth/c9c7cdb7dae0b8b350a4ba37b2ea286c to your computer and use it in GitHub Desktop.
name-test
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
var pattern = /^[A-Z][a-z]+(\s[A-Z][a-z]+)*$/; | |
var str1 = "Hein Thant Maung Maung"; | |
var str2 = "Huang Ying Yue"; // not my name; my in-game name LOL | |
var str3 = "H31iUM"; | |
console.log(str1.test(pattern)); // true | |
console.log(str2.test(pattern)); // true | |
console.log(str3.test(pattern)); // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment