Link to home
Start Free TrialLog in
Avatar of pemurray
pemurray

asked on

Email Address Validation - Failing on space in string

Greetings All,

I have code from buasuwan that allows me to check an email address to make sure it is properly formatted.  But it still seems to allow an email address to pass if it has a space in it.  I am not sure what is wrong.  Can someone help please?

Here is the code and pattern:

If email1 <> "" then
if match(email1,'^[a-zA-Z0-9][a-zA-Z\0-9\-_\.]*[^.]\@[^.][a-zA-Z\0-9\-_\.]+\.[a-zA-Z\0-9\-_\.]*[a-zA-Z\0-9]+$') then
email1flag = 'Y'      
end if
end if
If email1 <> "" then
		if match(email1,'^[a-zA-Z0-9][a-zA-Z\0-9\-_\.]*[^.]\@[^.][a-zA-Z\0-9\-_\.]+\.[a-zA-Z\0-9\-_\.]*[a-zA-Z\0-9]+$') then
			email1flag = 'Y'	
		end if
	end if

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of diasroshan
diasroshan
Flag of Kuwait 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