Skip to content

Instantly share code, notes, and snippets.

@heinthanth
Created September 1, 2019 09:34
Show Gist options
  • Save heinthanth/c9c7cdb7dae0b8b350a4ba37b2ea286c to your computer and use it in GitHub Desktop.
Save heinthanth/c9c7cdb7dae0b8b350a4ba37b2ea286c to your computer and use it in GitHub Desktop.
name-test
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