export const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ ; export function adjustEmail ( email ? ) { if ( ! email ) return email ; const parts = < RegExpMatchArray > email . match ( EMAIL_REGEX ) ; if ( ! parts || parts . length < 5 ) return undefined ; const domain = parts [ 5 ] ; const user = parts [ 1 ] ; if ( domain === "gmail.com" || domain === "googlemail.com" ) { return user . replace ( /[.]|(\+.*)/g , "" ) + "@gmail.com" ; } return email ; }