function isEmail(field, ErrorMsg) {
var strMsg = "";
var chAt = '@';
var chDot = '.';
var strEmailAddr = trim(field.value);
if (strEmailAddr.length == 0) return true;
if (strEmailAddr.indexOf(" ") == -1)
{
var iFirstAtPos = strEmailAddr.indexOf(chAt);
var iLastAtPos = strEmailAddr.lastIndexOf(chAt);
if (iFirstAtPos > 0 && iFirstAtPos < (strEmailAddr.length - 1) &&iFirstAtPos == iLastAtPos) {
// look for '.' there must be at least one char between '@' and '.'
var iDotPos = strEmailAddr.indexOf(chDot, iFirstAtPos + 1);
if (iDotPos > (iFirstAtPos + 1) && iDotPos < (strEmailAddr.length -1)) return true;
}
}
alert(ErrorMsg);
field.focus();
return false;
}
echo "<center><br><br><span style='font-size:16px; color:#840000;'><b>".$emailError."<a href='javascript:history.go(-1)'>Go Back and Redo!</a></b></span></center>\n";
exit;
} else if(!preg_match("/^[\w-]+[@]+[a-z]+\.+[a-z]*$/", $_POST['email'])) {
//} else if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email'])) {
$emailError = "Invalid email format. ";
$email ="";
echo "<center><br><br><span style='font-size:16px; color:#840000;'><b>".$emailError."<a href='javascript:history.go(-1)'>Go Back and Redo!</a></b></span></center>\n";
exit;
$re = '/[\w-.]+[@]+[a-z]+\.+[a-z]*/m';
$str = 'gmail.gmail.com@gmail.com
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Category Forum
General DiscussionLabels
None yet
Statistics
2 participants
Notifications
You are not receiving notifications from this thread.
Related Questions