0

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.

Haseeb
  • 361
  • 2
  • 20
  • Check [this](http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address) question. Your email validation is 'optimistic'. Usually it makes no sense to really validate an email. I usually just check for `@` and leave it at that :) – Laoujin Feb 13 '14 at 12:50

1 Answers1

0

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);
}
pgl
  • 7,551
  • 2
  • 23
  • 31