Re: Postgre RAISE NOTICE and PHP

From: merlyn(at)stonehenge(dot)com (Randal L(dot) Schwartz)
To: Clemens Schwaighofer <clemens_schwaighofer(at)e-gra(dot)co(dot)jp>
Cc: Andre Lopes <lopes80andre(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Postgre RAISE NOTICE and PHP
Date: 2009-08-19 14:41:04
Message-ID: 86y6pf27en.fsf@blue.stonehenge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "Clemens" == Clemens Schwaighofer <clemens_schwaighofer(at)e-gra(dot)co(dot)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}(at)[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(dot)*(at)(dot)*\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(at)stonehenge(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-08-19 15:14:54 Re: text type has no default operator class for GIN?
Previous Message Adrian Klaver 2009-08-19 14:22:34 Re: Function Logging