Validate email with regexp
7
So... this is a simple and great
way for validate email address using regular expressions. happy programming!
Function IsEmail(email_to_eval)
dim isValidE
dim regEx
isValidE = True
set regEx = New RegExp
regEx.IgnoreCase = False
regEx.Pattern = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
isValidE = regEx.Test(email_to_eval)
IsEmail = isValidE
End Function






function isEmail($email)
{
return preg_match('/^(([^()[\]\\.,;:\s@"\']+(\.[^()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email);
}
Btw. This regexp string is a litle better than the one proposed by the snippet author.
And for all of you who just wants the regexp and really can't read or hate to read PHP code, here it is:
^(([^()[\]\\.,;:\s@"\']+(\.[^()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$
-----------------------
http://jiart.org/
My digital playground with it's own sandbox.
Well anyway, I love programming
-----------------------
http://jiart.org/
My digital playground with it's own sandbox.
Well anyway, I love programming