Regular Expression for email validation
Unfortunately regular expressions are something I know nothing about.
I am trying to validate an email address using javascript and this is what I am using:
var expression = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;
However this doesn't allow for someone to use a filter on a gmail address e.g.
[email protected]
Can anyone help me with finding an expression that will allow me to do this?
Thanks.
Re: Regular Expression for email validation
I have the same problem. Are you looking at it from a framework point of view (say asp.net)?
Re: Regular Expression for email validation
I'm not quite sure what you mean but I am using this for a client side validation of an email address on a web page using javascript. The server side validation will be the same but using php.
Re: Regular Expression for email validation
I found this in the VB.NET codebank.
Re: Regular Expression for email validation
As I said before, I am no expert, however it seems to me that that one still does not allow a plus, and unless I am mistaken it also only allows the address to have 2 sub domains?