Skip to content

Instantly share code, notes, and snippets.

@maxparm
Created April 9, 2012 17:10
Show Gist options
  • Select an option

  • Save maxparm/2344791 to your computer and use it in GitHub Desktop.

Select an option

Save maxparm/2344791 to your computer and use it in GitHub Desktop.

Revisions

  1. maxparm revised this gist Apr 12, 2012. No changes.
  2. maxparm created this gist Apr 9, 2012.
    3 changes: 3 additions & 0 deletions validate-email.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    function isEmail(email){
    return /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/.test(email);
    }