Skip to content

Instantly share code, notes, and snippets.

@oskarnrk
Last active April 29, 2021 06:57
Show Gist options
  • Save oskarnrk/23ff0c8a510428a51fa700b551623797 to your computer and use it in GitHub Desktop.
Save oskarnrk/23ff0c8a510428a51fa700b551623797 to your computer and use it in GitHub Desktop.
Check if is a valid URL
const validEmailRegexp = /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i;
const isValidEmail = email => validEmailRegexp.test(email);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment