freelance84 Posted May 26, 2011 Share Posted May 26, 2011 if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ //email was valid } Trying to replace the eregi function with preg_match but i dont think its working. This is what i got: if(preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ //this email is valid } What ever the content of $email in the preg_match version, it simply returns true... is the pattern wrong for preg_match? (patterns are no strong point of mine at the moment) Quote Link to comment https://forums.phpfreaks.com/topic/237512-eregi-to-preg_match/ Share on other sites More sharing options...
freelance84 Posted May 26, 2011 Author Share Posted May 26, 2011 Sorry. Should have googled it first: http://myphpform.com/validating-url-email.php Quote Link to comment https://forums.phpfreaks.com/topic/237512-eregi-to-preg_match/#findComment-1220511 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.