Forum Moderators: coopster
a) posting an email address anywhere in the message
b) posting a telephone number (between 11 and 13 consecutive digits) anywhere in the message
Here is the function I have that doesnt really work unless you put only an exact email or telephone number in. Can anyone make this better?
function contains_contact_details($msg) {
$out = false;
if (preg_match("/[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$/s", $msg)) {
$out = true;
}
else {
$msg = preg_replace("/([^0-9a-zA-Z])/", "", $msg);
if (preg_match('/^\d{11,13}$/', $msg)) $out = true;
}
return $out;
}