0

I have a website: http://www.admiraltax.pl/zamow_darmowa_konsultacje

I tried to validate js e-mail address that could give 5 characters after the dot, eg. D4rqu@testowy.EMAIL.

Validator worked for me only max 4 characters,

I changed main.js, but it doesn't work :(

validEmail function (e-mail)
{
             var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0- 9] {2,6}) + $ /;
             if (filter.test (e-mail))
                 return true;
             else
                 return false;
}
Yu Zhang
  • 2,037
  • 6
  • 28
  • 42

2 Answers2

0

Perhaps something a bit more simple works ?

/.+@.+/

or you could try this:

\^([\w]+)\@([\w]+){5}\.([\w]+)$\
Onilol
  • 1,315
  • 16
  • 41
0

Its not js, i correct form.php:

public function is_email($name) {

    if (array_key_exists($name, $this->post) === false)
        return false;

    if (!is_string($this->post[$name]))
        return false;


    $email = $this->post[$name];
    $reg   = '#^(([[:alnum:]]|[\_\.\-])+@[[:alnum:]]([[:alnum:]]|[\_\.\-])*\.([[:alpha:]]){2,6})$#si';

    if (!preg_match($reg, $email))
        return false;

    return true;
    }

And now its work