Re: Postgre RAISE NOTICE and PHP - Mailing list pgsql-general

From merlyn@stonehenge.com (Randal L. Schwartz)
Subject Re: Postgre RAISE NOTICE and PHP
Date
Msg-id 86y6pf27en.fsf@blue.stonehenge.com
Whole thread Raw
In response to Postgre RAISE NOTICE and PHP  (Andre Lopes <lopes80andre@gmail.com>)
Responses Re: Postgre RAISE NOTICE and PHP
Re: Postgre RAISE NOTICE and PHP
List pgsql-general
>>>>> "Clemens" == Clemens Schwaighofer <clemens_schwaighofer@e-gra.co.jp> writes:

Clemens> Just in my opinion, this regex is completely too large. For basic
Clemens> validating something like:
Clemens>
^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%&'*+-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,4}){1}$
Clemens> works very well

Fails on ".mobile" TLD.  Has a pointless {1} in it, which does
absolutely nothing, providing that the creator of the regex was already
missing a few clues.

That's the problem with these kinds of regex... you test it on what
you know, but you're not consulting the *actual* *internet* specifications
(which have been readily available since the dawn of Internet time).

Either use the regex I pointed to already, or stay with the simpler:

  /\S.*@.*\S/

which will at least not deny anyone with a *perfectly legitimate* email
address from making it into your system.

Or, use your regex *only* in an *advice* category, with the ability
for the user to say "yes, I'm really sure this is my address".

Please, for the sake of the net, do the Right Thing here.  This is
what I'm arguing for.  Anything less than that, and your code deserves
to end up in thedailywtf.com as an example of what *not* to do.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Function Logging
Next
From: Sam Mason
Date:
Subject: Re: text type has no default operator class for GIN?