Skip to content

Instantly share code, notes, and snippets.

@CodeIter
Created February 4, 2016 05:36
Show Gist options
  • Save CodeIter/9962111a630140faa7c6 to your computer and use it in GitHub Desktop.
Save CodeIter/9962111a630140faa7c6 to your computer and use it in GitHub Desktop.
regex.js
/* cin email password phone username */
/^((([a-zA-Z]|[0-9])|([-]|[_]|[.]))+[@](([a-zA-Z0-9])|([-])){2,63}[.](([a-zA-Z0-9]){2,63})+)|(([_a-zA-Z0-9]+){3,20})|(\+?\d{1,4}?[-.\s]?\(?\d{1,3}?\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9})$/gm
/*cin*/
/^([0-9]){8}$/
/*username*/
/^([_a-zA-Z0-9]+){3,20}$/gm
/*password*/
/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/gm
/*all phone*/
/\+?\d{1,4}?[-.\s]?\(?\d{1,3}?\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}/g
/*generic email*/
/^(([a-zA-Z]|[0-9])|([-]|[_]|[.]))+[@](([a-zA-Z0-9])|([-])){2,63}[.](([a-zA-Z0-9]){2,63})+$/gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment