Page 1 of 1

Email validation - apostrophe

Posted: Mon Jan 14, 2008 10:09 am
by aceconcepts
Hi,

I currently use a rather good email validation script, however, it does not validate apostrophes '.

I had a user register their email address and it was "o'connor@..."

My current validation prevented this user from using that email address.

How can I validate the use of apostrophes?

Thanks.

Re: Email validation - apostrophe

Posted: Mon Jan 14, 2008 11:00 am
by Kieran Huggins
once the search index is back you can search for "email validation regex" for an RFC compliant version, then it's just a matter of running preg_match().

You can probably find the same thing on Google.

Re: Email validation - apostrophe

Posted: Mon Jan 14, 2008 11:04 am
by aceconcepts
Thanks

Re: Email validation - apostrophe

Posted: Mon Jan 14, 2008 11:33 am
by Inkyskin
Are apostrophes a valid email char? I have never seen it used before...

Re: Email validation - apostrophe

Posted: Mon Jan 14, 2008 11:46 am
by Kieran Huggins
strictly, yes; it's part of the spec. Though many email servers don't allow local account creation with one.

I have seen them used, and had to fix my app to allow them.

Re: Email validation - apostrophe

Posted: Mon Jan 14, 2008 11:55 am
by Inkyskin
Ah ok, ta. Time to modify my regex's... bugger.