"._("Example:")." ".$example;
}
/* If validChars are posted, take data and paint all invalid
characters... */
if ($regex) {
$result= "";
$mismatch= "";
foreach (str_split($data) as $currentChar){
if (preg_match("$regex", $currentChar)){
$result.= $currentChar;
} else {
$result.= "".htmlentities($currentChar)."";
$mismatch.= $currentChar;
}
}
return sprintf(_("The Field '%s' contains invalid characters"), $name).". ".
(strlen($mismatch)==1?sprintf(_("'%s' is not allowed:"), htmlentities($mismatch)):sprintf(_("'%s' are not allowed."), htmlentities($mismatch))).
"
\"$result\"$example";
} else {
return sprintf(_("The Field '%s' contains invalid characters"), $name)."!$example";
}
}
}