电子邮件js验证器无法正常工作

时间:2015-09-01 20:42:40

标签: javascript validation email

我有一个网站:http://www.admiraltax.pl/zamow_darmowa_konsultacje

我试图验证js电子邮件地址,该地址可以在点之后提供5个字符,例如。 D4rqu@testowy.EMAIL。

Validator最多只为我工作4个字符,

我更改了main.js,但它不起作用:(

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;
}

2 个答案:

答案 0 :(得分:0)

也许更简单的东西可以起作用?

declare @amounts table (TotalAmount decimal(8,2),[UF%] decimal(4,2), [UFI%] decimal(4,2)
                                                ,[RA%] decimal(4,2),[RL%] decimal(4,2)
                                                ,[NP%] decimal(4,2));
insert into @amounts values
 (100,0.00,20,9.15,0.75,70.01)  
,(1520.23,64.4,19.1,15.5,0.25,0.75)   
,(158520.03,13.25,35,2.25,19.28,30.22);

select up.TotalAmount
      ,up.Percentag
      ,(up.TotalAmount/100)*up.Percentag AS AmountPercentage
      ,up.Amount AS AmountType
from
(
    select *
    from @amounts  
) AS tbl
unpivot
(
    Percentag FOR Amount IN([UF%],[UFI%],[RA%],[RL%],[NP%])
) AS up

或者你可以试试这个:

/.+@.+/

答案 1 :(得分:0)

它不是js,我正确的形式.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;
    }

现在它的工作