I have a class that uses PHP's ereg()
which is deprecated.
Looking on PHP.net I thought I could just get away and change to preg_match()
But I get errors with the regular expressions or they fail!!
Here are two examples:
function input_login() {
if (ereg("[^-_@\.A-Za-z0-9]", $input_value)) { // WORKS
// if (preg_match("[^-_@\.A-Za-z0-9]", $input_value)) { // FAILS
echo "is NOT alphanumeric with characters - _ @ . allowed";
}
}
// validate email
function validate_email($email) {
// return eregi("^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$", $email); // FAILS
}