RE: [PHP] Ereg() Function

From: Date: Sat, 24 May 2003 00:25:30 +0000
Subject: RE: [PHP] Ereg() Function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148815@lists.php.net to get a copy of this message
You may want to try "eregi" instead (if you're having issues with case sensitvity). There are abundant examples on the the eregi pages at http://www.php.net. You can also look at http://regexlib.com/Default.aspx. Also, if you're checking email addresses check out the checkdnsrr() function to validate that the host has a valid DNS record. --Joe -- Joe Stump <joe@joestump.net> http://www.joestump.net "Label makers are proof God wants Sys Admins to be happy." -----Original Message----- From: Daniel J. Rychlik [mailto:drychlik@tcsconsult.com] Sent: Friday, May 23, 2003 2:19 PM To: php-general@lists.php.net Subject: [PHP] Ereg() Function If I wanted to check for a valid email address, basically and email that has @ and some domain like .edu, .net or something, why wont this work ? if (ereg ("^[\w.-]+@[\w.-]+\.(com|net|org|edu|mil|gov|gob|info|tv|biz) +(\.[A-Za-z]{2}|\s*)$", $_POST["emailaddy"])) { echo "doesnt appear to be a valid mail addy"; } Im not understanding why $_POST["emailaddy"] is not being evaluated correctly. Im putting in non-valid email addresses and I expect this to return true, but it doesnt. Any Ideas.? -Dan

« previous php.general (#148815) next »