[pmwiki-devel] Email pattern...

Martin Fick mogulguy at yahoo.com
Thu May 31 14:59:32 CDT 2007


--- 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 .+\..+$/
> > >
> > > Can someone help me spot what I'm missing? Or
> suggest a better pattern?
> >
> > If you're willing to accept names without dots in
> the second half,
> > then don't require it:
> >
> >    /^.+ at .+$/
> >
> > This basically says to match any string containing
> an @ sign somewhere
> > in the middle of the string and no newlines.
> 
> 
> Actually that's what I'm trying to avoid. I want it
> to fail when there
> is no dot in the second half. Currently it seems to
> be passing emails
> like that in my form validation. If my initial
> pattern was correct, I
> suppose it could be a ZAP problem, but it seems more
> likely the problem is in my pattern.

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:

 '/^[^@]+@[^@]+\.[^@]+$/'

-Martin




      ____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!   http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 





More information about the pmwiki-devel mailing list