By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,937 Members | 1,416 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,937 IT Pros & Developers. It's quick & easy.

Regular Expression for validate email address

P: 66
Hello.

I have this Regular Expression for validate email address in my form:

[php]var re = new RegExp("^[a-z][a-z0-9]*\\.[a-z][a-z0-9]*(\-WEDNES)?@Names\\.com$", "i");[/php]

Why invalid this email address ??? :

mark.d'ausilio-WEDNES@Names.com

Is the ' ?
The ' can exist but is not obligatory...

Can you help me?
Thanks
Apr 30 '08 #1
Share this Question
Share on Google+
7 Replies


Expert 100+
P: 392
Why invalid this email address ??? :

mark.d'ausilio-W
The regular expression allows for letters and numbers, but that address has special characters in it. I am not sure if " ' " is allowed my most email servers. Even if it works in your specific setup it may not work when others try to send email to you, so it would be a good idea to change it.
Apr 30 '08 #2

P: 66
The regular expression allows for letters and numbers, but that address has special characters in it. I am not sure if " ' " is allowed my most email servers. Even if it works in your specific setup it may not work when others try to send email to you, so it would be a good idea to change it.
these emails are business and assigned by the webmaster for name and surname employee... can not be changed...
Apr 30 '08 #3

Expert 100+
P: 392
these emails are business and assigned by the webmaster for name and surname employee... can not be changed...
So what? None of that changes what I already told you. Your admins email setup choices do change how regular expressions work. If your emails are going to have special characters then your expression will have to allow them to valid them.
Apr 30 '08 #4

P: 66
So what? None of that changes what I already told you. Your admins email setup choices do change how regular expressions work. If your emails are going to have special characters then your expression will have to allow them to valid them.
How to change regular expression to validate character ' ?
Apr 30 '08 #5

acoder
Expert Mod 15k+
P: 16,027
If you must, add the single quote in the [a-z0-9] part, i.e. [a-z0-9']
May 1 '08 #6

P: 66
If you must, add the single quote in the [a-z0-9] part, i.e. [a-z0-9']
many thanks !!!!
working !!!
May 2 '08 #7

acoder
Expert Mod 15k+
P: 16,027
You're welcome. Never doubted that it wouldn't ;)
May 2 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.