TimUSA Posted March 25, 2008 Share Posted March 25, 2008 I am having a problem. this code is excepting [email protected], but not [email protected]?? I am not very good with this so some help would be appreciated! if (preg_match("/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_- ])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/", $_POST['email'])) { die("Invalid e-mail address"); } Link to comment https://forums.phpfreaks.com/topic/97830-email-format-validation/ Share on other sites More sharing options...
discomatt Posted March 25, 2008 Share Posted March 25, 2008 Matches fine for me... But i think you want to check if it doesn't match, using !preg_match Link to comment https://forums.phpfreaks.com/topic/97830-email-format-validation/#findComment-500525 Share on other sites More sharing options...
soycharliente Posted March 25, 2008 Share Posted March 25, 2008 I use this pattern for email matching. /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*(([,]|[,])\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*$/ Don't ask. Link to comment https://forums.phpfreaks.com/topic/97830-email-format-validation/#findComment-500536 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.