There is this cute suggestion in the Wrox PHP book:

/^.+@.+\\..+$/

Looks like a puzzle, but it works (almost) always.

Enjoy

Ignatius Reilly


--------------------------------------------------------------------------------

  ----- Original Message ----- 
  From: DL Neil 
  To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
  Sent: Wednesday, August 21, 2002 10:04 PM
  Subject: Re: [PHP-DB] form validation question - regex not working


  Regarding the problem you are actually asking about:

  > > > if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])
  > +\.
  > > > ([A-Za-z]{2,3})+$", $useremail))
  > > Notice the {2,3} which is supposed to limit the last part to 2 or 3
  > > letters, but I have been testing this and
  > > it allows as many letters as I put in there, but not 1 only.
  > > What's wrong?

  Please be aware that I use PCRE not POSIX, but IIRC the last phrase says:

  ([A-Za-z]{2,3})+$

  any upper or lower case letter,
  repeated twice or three times,
  and that appearing zero or more times, !!!???
  appearing at the end of the string.

  Remove the + immediately before the terminating $.

  Regards,
  =dn



  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php


Reply via email to