Skip to content

Instantly share code, notes, and snippets.

@markhowellsmead
Last active November 9, 2023 04:21
Show Gist options
  • Save markhowellsmead/48f4f62acd7f75afaceaffab430c0345 to your computer and use it in GitHub Desktop.
Save markhowellsmead/48f4f62acd7f75afaceaffab430c0345 to your computer and use it in GitHub Desktop.
Regex for valid email address excluding specific free domains, like Gmail, GMX and Yahoo. Extend the list of domains according to your own requirements.
^([\w.-]+)@(\[(\d{1,3}\.){3}|(?!hotmail|gmail|googlemail|yahoo|gmx|ymail|outlook|bluewin|protonmail|t\-online|web\.|online\.|aol\.|live\.)(([a-zA-Z\d-]+\.)+))([a-zA-Z]{2,4}|\d{1,3})(\]?)$
@alexk1350
Copy link

.net What you have hear "^([\w.-]+)@([(\d{1,3}.){3}|(?!hotmail|gmail|googlemail|yahoo|gmx|ymail|outlook|bluewin|protonmail|t-online|web.|online.|aol.|live.)(([a-zA-Z\d-]+.)+))([a-zA-Z]{2,4}|\d{1,3})(]?)$" works well with exception of case sensitivity. gMail, oUtlook etc. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment