Link to home
Start Free TrialLog in
Avatar of slightlyoff
slightlyoff

asked on

Regular Expression - allow emails with period in the name.

I had ran into an issue previously where my regex expression wasn't allowing periods in the name for emails.  for example, my.email@gmail.com wouldn't work.  Thanks to the fine experts at Experts-Exchange, that is working now.

However, email addresses like my.email75@gmail.com or myemail.11@gmail.com don't work.  Here's my expression & the function i'm using:

function regIsEmail(fData){ 
 				
				var reg = new RegExp("^[0-9a-zA-Z\_]+@[0-9a-zA-Z]+[\.]{1}[0-9a-zA-Z]+[\.]?[0-9a-zA-Z]+$");
				return reg.test(fData); 
	}

Open in new window


To me it looks like it's allowing numbers - so I'm not sure  what needs to be changed.  Any suggestions?
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

I'd go here to find an email validation regex. There are loads:

http://www.regexlib.com/RETester.aspx?regexp_id=26
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slightlyoff
slightlyoff

ASKER

Thank you for your help!  that worked great!
Thank you Lee - I did go there, but finding an expression that had all the components was difficult.  now that people can make email addresses like my_name.75@gmail.co.uk it's getting kind of crazy out there...