Skip to content

Instantly share code, notes, and snippets.

@NishiGaba
Last active August 1, 2017 07:15
Show Gist options
  • Save NishiGaba/afbb2d44299c6d288986eb8a9dd2cfeb to your computer and use it in GitHub Desktop.
Save NishiGaba/afbb2d44299c6d288986eb8a9dd2cfeb to your computer and use it in GitHub Desktop.
Regex for different combinations in Javascript
//Regex for only Alphanumeric Characters with Space Included
var regex = new RegExp("^[a-zA-Z ]+$");
//Verifying Contact Number
var contact = 1234567890;
var isnum = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/.test(contact);
//You can Refer this site for more Regex or You can Create your own Regex : http://regexr.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment