Re: Form Validation

From: Date: Tue, 08 Aug 2000 15:21:45 +0000
Subject: Re: Form Validation
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-10694@lists.php.net to get a copy of this message
dave@musiccity.net (Dave Daniels) writes: > To check email, you can use a function like this: > > function validateEmail($email) { > > if > (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.(com|net|edu|org|mil))$",$ > email)){ > return 1; > } else { > return 0; > } > > } Don't use this regular expression; It will deny many valid addresses (everything with a country top level domain for a start), and it'll allow through a lot of invalid ones. -robin -- Robin Vickery............................................... Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK Email: robin@planet-three.co.uk Phone: +44 (0)794 670 6395

« previous php.general (#10694) next »