[pmwiki-devel] Email pattern...

Martin Fick mogulguy at yahoo.com
Thu May 31 15:53:46 CDT 2007


--- "Patrick R. Michaud" <pmichaud at pobox.com> wrote:
> On Thu, May 31, 2007 at 01:26:27PM -0700, Martin
> Fick wrote:
> > --- "Patrick R. Michaud" <pmichaud at pobox.com>
> wrote:
> > > > Also, you probably don't want multiple @s in
> your
> > > > expression, so maybe:
> > > > 
> > > >  '/^[^@]+@[^@]+\.[^@]+$/'
> > > 
> > > Actually, you really don't want whitespace in
> the
> > > expression either, so:
> > > 
> > >     '/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/'
> > > 
> > > Still better is to be explicit about what is
> > > allowed, as opposed to what is forbidden:
> > > 
> > >     '/^[-+.\\w]+@[-+\\w]+\\.[-+.\\w]+$/'
> > 
> > Sure, as long as you are 100% positive about what
> is
> > permitted (...which I assume you are.)
> 
> I'm not 100% positive, ...

Well, from here:

http://www.regular-expressions.info/email.html

it is worth noting that the % and _ are valid in the
user name, I would make at least that one addition.

    '/^[-+.%_\\w]+@[-+\\w]+\\.[-+.\\w]+$/'

Not sure that the pluses are needed either...

-Martin



       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/



More information about the pmwiki-devel mailing list