10 examples of 'bootstrap email validation' in JavaScript

Every line of 'bootstrap email validation' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
20email(err) {
21 return this.rule(function(email) {
22 if (!email) return false;
23
24 if (email.length > 254) return false;
25
26 var valid = emailRegex.test(email);
27 if (!valid) return false;
28
29 // Further checking of some things regex can't handle
30 var parts = email.split('@');
31 if (parts[0].length > 64) return false;
32
33 var domainParts = parts[1].split('.');
34 if (
35 domainParts.some(function(part) {
36 return part.length > 63;
37 })
38 )
39 return false;
40
41 return true;
42 }, err || t('STRING_RULE_EMAIL'));
43}
10function validateEmail (email) {
11 if (email && email.match(/^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i)) {
12 return true
13 }
14
15 return false
16}
209function validateEmail(emailTest) {
210 var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;
211 if (filter.test(emailTest) && emailTest.length < 99) {
212 return true;
213 } else {
214 return false;
215 }
216}
20function validate_email(email)
21{
22 var emailReg = /\S+@\S+\.\S+/;
23
24 if(!emailReg.test(email)) {
25 return false;
26 }
27
28 return true;
29}
14validate(data: string) {
15 if (typeof data !== 'string' || !data.toLowerCase().match(this.regex)) return false;
16 return true;
17}
8function validateEmail (val) {
9 return /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(val);
10}
118function on_validation(name, value) {
119 switch (name) {
120 case 'name':
121 case 'street':
122 case 'city':
123 return value.length > 0;
124 case 'email':
125 return value.isEmail();
126 case age:
127 // The value will be always Number (The framework compares types)
128 return value > 18 && value < 60;
129 }
130}
1export default function validateEmail(email: string) {
2 // tslint:disable-next-line:max-line-length
3 const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
4 return reg.test(email) && email !== '' && email.length > 0;
5}
225function validateEmail(email) {
226 if (email.length <= 0) {
227 return false;
228 }
229 var emailPattern = /\S+@\S+\.\S+/;
230 return emailPattern.test(email);
231}
15public static emailValidator(control: AbstractControl): boolean {
16 // RFC 2822 compliant regex
17 /* tslint:disable */
18 if (control.value.match(/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/)) {
19 /* tslint:enable */
20 return false;
21 }
22 return true;
23}

Related snippets