1

Possible Duplicate:
Is there a php library for email address validation?

Hi there, I was just wondering if any of you use a particular public script or set of functions for dealing with email validation in PHP. The built-in PHP function isn't really anything to brag about.

Thanks for your time.

Community
  • 1
  • 1
soren.qvist
  • 7,376
  • 14
  • 62
  • 91

1 Answers1

1

I use to validate with cakephp function which can be found here

The regexp is this one:

'^[a-z0-9!#$%&*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+(?:[a-z]{2,4}|museum|travel)$'

and can be found here

Enrico Carlesso
  • 6,818
  • 4
  • 34
  • 42
  • 1
    At the end it also excludes museum and travel? – soren.qvist Feb 28 '10 at 20:44
  • 1
    No, it validates every 2-4 letter first-level domain (com, it, en, es, uk, org...) and the two long exceptions, .museum and .travel (which are first-level domains to, as shown http://en.wikipedia.org/wiki/Generic_top-level_domain). In simple words, museum and travel are the only two first-level domain longer than 4 char, so must be included. – Enrico Carlesso Feb 28 '10 at 20:49
  • Oh, didn't even know those existed. Thanks. – soren.qvist Feb 28 '10 at 20:58