Re: form validation question - regex not working

From: Date: Thu, 22 Aug 2002 20:26:02 +0000
Subject: Re: form validation question - regex not working
Groups: php.db 
Request: Send a blank email to php-db+get-21319@lists.php.net to get a copy of this message
Jason Wong <phplist@gremlins.com.hk> wrote on 08/21/2002 08:06:42 PM: > On Thursday 22 August 2002 04:01, chip.wiegand@simrad.com wrote: > > Got it figured out, and foreign address do work now - > > if (empty($useremail) || > > !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.([A-Za-z])+\.([a-z]) *$", > > $useremail)) > What do you mean by 'foreign' addresses? > The above will still fail for: > me@here.there.everywhere.com > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk This is a revised version, which does validate the example you provide: "^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-] +)+$" By foreign I meant addresses that end in .au, .fr, .no, etc, didn't mean to offend you in any way. :) -- Chip

« previous php.db (#21319) next »