Skip to content

Instantly share code, notes, and snippets.

@midnightcodr
Created August 23, 2018 13:37
Show Gist options
  • Select an option

  • Save midnightcodr/37d33cce0fe9e1643960f3fa3a459b15 to your computer and use it in GitHub Desktop.

Select an option

Save midnightcodr/37d33cce0fe9e1643960f3fa3a459b15 to your computer and use it in GitHub Desktop.
// handy function to strip the plusing part of a email address with +
const stripPlusing = em => em.replace(/\+[^@]+/, '')
console.log(stripPlusing('myemailaddress@mycompany.com'))
console.log(stripPlusing('myemailaddress+123@mycompany.org'))
console.log(stripPlusing('myemailaddress+abc123@mycompany.net'))
/*
myemailaddress@mycompany.com
myemailaddress@mycompany.org
myemailaddress@mycompany.net
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment