Skip to content

Instantly share code, notes, and snippets.

@dfkaye
Created May 10, 2024 20:51
Show Gist options
  • Save dfkaye/41ece9a08a6b447c8d933ad0e573557c to your computer and use it in GitHub Desktop.
Save dfkaye/41ece9a08a6b447c8d933ad0e573557c to your computer and use it in GitHub Desktop.
email valid regex quick and dirty from Kyle Simpson
// 10 May 2024
// Not mine! The regexp is from a tweet by Kyle Simpson
// https://twitter.com/getifyX/status/1788895673821118886
var reEmailAddress = /^[^@]+@[^@.]+(?:\.[^@.]+)+$/;
["a@b.c", { toString: () => "a@b.c" }, ["a@b.c"]].map(email => reEmailAddress.test(email));
// Array(3) [ true, true, true ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment