Monday, February 21, 2011

Email validation in PHP

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.

From stackoverflow
  • 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

    soren.qvist : Great! Thanks, I'll check it out
    soren.qvist : At the end it also excludes museum and travel?
    Enrico Carlesso : 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.
    soren.qvist : Oh, didn't even know those existed. Thanks.
    Enrico Carlesso : You're welcome.

0 comments:

Post a Comment