Last active
April 29, 2016 15:13
-
-
Save ViBiOh/07a954f5ff2ac4bc72c4 to your computer and use it in GitHub Desktop.
Clean a Gmail address to its real identifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
email.trim().replace(/^(.*?)(?:\+.*?)?(@gmail\.com)$/gi, '$1$2').replace(/\.(?!com$)/g, ''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In its address, Gmail ignores dots and everything after the first plus sign. Mails sent to the "valid" address and those "disguised" will all go into the Inbox. Google allows you to generate personal addresses. This script removes everything superfluous to identify the unique address.