I'm trying to write a regular expression that checks if an email form field contains a free email address, with no luck.
Essentially I need to check if the email contains: hotmail
, yahoo
, gmail
etc in the email field.
I'm trying to write a regular expression that checks if an email form field contains a free email address, with no luck.
Essentially I need to check if the email contains: hotmail
, yahoo
, gmail
etc in the email field.
regex would be sth like:
you can add all the other domains you want... does it help you?
Have you tried a big ol' disjunction?
i.e.
yahoo\.com|googlemail\.com|blah\.net
Pros: Easy to build, easy to read, explicit.
Cons: Maybe not the most efficient mechanism.