Need to add specific characters to regular expression

Posted by lordryan on Stack Overflow See other posts from Stack Overflow or by lordryan
Published on 2011-03-15T16:05:22Z Indexed on 2011/03/15 16:09 UTC
Read the original article Hit count: 143

Filed under:

i'm using the following regular expression to form a basic email validation.

var emailRegEx = /^([a-zA-Z0-9])(([a-zA-Z0-9])*([\._\+-])*([a-zA-Z0-9]))*@(([a-zA-Z0-9\-])+(\.))+([a-zA-Z]{2,4})+$/;

this works pretty well for what i need but i also need to exclude these specific characters for reasons i won't go into.

!,#,$,%,^,&,*,(,),-,+,|,{,},[,],:,>,<,?,/,\,= - (the characters between the "," if that isn't clear)

could someone help me with adding the second group to the first? I know the pro's and cons of using javascript to validate email addresses - i have to do it this way. thanks.

© Stack Overflow or respective owner

Related posts about regex