[pmwiki-devel] Email pattern...
Patrick R. Michaud
pmichaud at pobox.com
Thu May 31 15:30:09 CDT 2007
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, but I'm certain that the above
would work for the vast majority of email addresses
that are out there, while still rejecting any that contain
whitespace, lack an '@', or lack a dot in the domain name. :-)
Pm
More information about the pmwiki-devel
mailing list