Here is my code for to validate email address and this is perfect for my requirement. but i want to translate this format into Japanese language.Or Tell me such regular expression which used for multiple languages
if ( ! function_exists('valid_email')){
function valid_email($address)
{
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
}}
Thanks in Advance.
To validate an email in PHP, use PHP's built in filters. See here for full details:
Taken from the above URL, here's an example of how to validate an email:
if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
echo "This ($email_a) email address is considered valid.";
}
Applied to your code, this would make your valid_email()
function the following:
function valid_email($address)
return filter_var($address, FILTER_VALIDATE_EMAIL);
}