简体   繁体   English

javascript/jquery 中是否有任何内置的 function 来过滤 email 就像 php 的 function (,filter_var($variablePassed, FILTER_VALIDATE_EMAIL))

[英]Is there any built in function in javascript/jquery to filter email like php's function (!filter_var($variablePassed, FILTER_VALIDATE_EMAIL))

// check if e-mail address is well-formed
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    $emailErr = "Invalid email format"; 
}

This code is filtering the email provided by the user.此代码正在过滤用户提供的 email。

My question is is there any built in function in javascript/jquery like this php built in function. Regex is doing it but some times regex stop working.I do not know why.我的问题是在 function 中是否有任何内置于 function 中的 php 之类的 function 内置于 function 中。正则表达式正在这样做,但有时正则表达式停止工作。我不知道为什么。 My question is not so good but my mind force me to ask so i can feel good.I cannot sleep without answer.我的问题不是很好,但我的思想迫使我问,这样我才能感觉良好。没有答案我无法入睡。

There is no built-in but 3rd-party library provided on NPM. NPM 上没有提供内置的第三方库。

https://github.com/mpyw/FILTER_VALIDATE_EMAIL.js https://github.com/mpyw/FILTER_VALIDATE_EMAIL.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM