[pmwiki-devel] Email pattern...

Patrick R. Michaud pmichaud at pobox.com
Thu May 31 15:18:22 CDT 2007


On Thu, May 31, 2007 at 12:59:32PM -0700, Martin Fick wrote:
> --- The Editor <editor at fast.st> wrote:
> > On 5/31/07, Patrick R. Michaud <pmichaud at pobox.com>
> > wrote:
> > > On Thu, May 31, 2007 at 06:31:02AM -0400, The
> > Editor wrote:
> > > > I put together this pattern to match for emails,
> > > > but it doesn't seem to catch something like email at example, ie
> > > > without a dot in the second
> > > > half.
> > > >
> > > > ="/^.+ at .+\..+$/
> 
> Since this is in double quotes, you should avoid
> non-escaped dollar signs.  I would try singe quotes:
> 
>  '/^.+ at .+\..+$/'
> 
> If that doesn't work, add another slash in front of
> your dot.
> 
> 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]+$/'

Pm



More information about the pmwiki-devel mailing list