Any questions involving matching text strings to patterns - the pattern is called a "regular expression."
Moderator: General Moderators
-
hame22
- Forum Contributor
- Posts: 214
- Joined: Wed May 11, 2005 5:50 am
Post
by hame22 »
Hi
My current email validation script will not allow any emails with a ' in to be validate e.g.(a.o'
reilly@domain.com).
I'm currently using:
Code: Select all
(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$", $email))
any ideas?
Thanks in advance
-
Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Post
by Chris Corbyn »
Wrong forum, PHPDN Suggestions is for forum suggestions
There are heaps of email regex out there. In fact, if you search this forum you'll find the definitive RFC compliant one.
-
hame22
- Forum Contributor
- Posts: 214
- Joined: Wed May 11, 2005 5:50 am
Post
by hame22 »
sorry complete mistake i put my question here, i am sorry!
-
Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
-
Contact:
Post
by Kieran Huggins »
add a ' to your character class
-
hame22
- Forum Contributor
- Posts: 214
- Joined: Wed May 11, 2005 5:50 am
Post
by hame22 »
sorry very stupid question I know but whre abouts is the character class in the expression?
thanks again
-
feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Post
by feyd »
Just use the RFC compliant regex that has been posted many many many times.
"validateEmailFormat"