Skip to main content
add image test
Source Link

Regex update 2018updated! try this

let val = '[email protected]';
if(/^[a-z0-9][a-z0-9-_\.]+@([a-z]|[a-z0-9]?[a-z0-9-]+[a-z0-9])\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val)) {
   console.log('passed');
}

typscript version complete

//
export const emailValid = (val:string):boolean => /^[a-z0-9][a-z0-9-_\.]+@([a-z]|[a-z0-9]?[a-z0-9-]+[a-z0-9])\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val);

more info https://git.io/vhEfc

regex test case

Regex update 2018! try this

let val = '[email protected]';
if(/^[a-z0-9][a-z0-9-_\.]+@([a-z]|[a-z0-9]?[a-z0-9-]+[a-z0-9])\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val)) {
   console.log('passed');
}

typscript version complete

//
export const emailValid = (val:string):boolean => /^[a-z0-9][a-z0-9-_\.]+@([a-z]|[a-z0-9]?[a-z0-9-]+[a-z0-9])\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val);

more info https://git.io/vhEfc

Regex updated! try this

let val = '[email protected]';
if(/^[a-z0-9][a-z0-9-_\.]+@([a-z]|[a-z0-9]?[a-z0-9-]+[a-z0-9])\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val)) {
   console.log('passed');
}

typscript version complete

//
export const emailValid = (val:string):boolean => /^[a-z0-9][a-z0-9-_\.]+@([a-z]|[a-z0-9]?[a-z0-9-]+[a-z0-9])\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val);

more info https://git.io/vhEfc

regex test case

fix regex link
Source Link

Regex update 2018! try this

let val = '[email protected]';
if(/^[a-z0-9][a-z0-9-_\.]+@[a]+@([a-z]|[a-z0-9][a9]?[a-z0-9-]+[a-z0-9]\9])\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val)) {
   console.log('passed');
}

typscript version complete

//more info https://git.io/vhEfc
export const emailValid = (val:string):boolean => !/(\.{2}|-{2}|_{2})/.test(val) && /^[a-z0-9][a-z0-9-_\.]+@[a]+@([a-z]|[a-z0-9][a9]?[a-z0-9-]+[a-z0-9]\9])\.[a-z]z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val);

more info https://git.io/vhEfc

Regex update 2018! try this

let val = '[email protected]';
if(/^[a-z0-9][a-z0-9-_\.]+@[a-z0-9][a-z0-9-]+[a-z0-9]\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val)) {
   console.log('passed');
}

typscript version complete

//more info https://git.io/vhEfc
export const emailValid = (val:string):boolean => !/(\.{2}|-{2}|_{2})/.test(val) && /^[a-z0-9][a-z0-9-_\.]+@[a-z0-9][a-z0-9-]+[a-z0-9]\.[a-z]{2,10}(?:\.[a-z]{2,10})?$/.test(val);

Regex update 2018! try this

let val = '[email protected]';
if(/^[a-z0-9][a-z0-9-_\.]+@([a-z]|[a-z0-9]?[a-z0-9-]+[a-z0-9])\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val)) {
   console.log('passed');
}

typscript version complete

//
export const emailValid = (val:string):boolean => /^[a-z0-9][a-z0-9-_\.]+@([a-z]|[a-z0-9]?[a-z0-9-]+[a-z0-9])\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val);

more info https://git.io/vhEfc

improvements
Source Link

Regex update 2018! try this

Regex update 2018! try this

let val = '[email protected]';
if(/^[a-z0-9][a-z0-9-_\.]+@[a-z0-9][a-z0-9-]+[a-z0-9]\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val)) {
   console.log('passed');
}

more tests heretypscript version complete

//more info https://git.io/vhEfc
export const emailValid = (val:string):boolean => !/(\.{2}|-{2}|_{2})/.test(val) && /^[a-z0-9][a-z0-9-_\.]+@[a-z0-9][a-z0-9-]+[a-z0-9]\.[a-z]{2,10}(?:\.[a-z]{2,10})?$/.test(val);

Regex update 2018! try this

if(/^[a-z0-9][a-z0-9-_\.]+@[a-z0-9][a-z0-9-]+[a-z0-9]\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val)) {
   console.log('passed');
}

more tests here

Regex update 2018! try this

let val = '[email protected]';
if(/^[a-z0-9][a-z0-9-_\.]+@[a-z0-9][a-z0-9-]+[a-z0-9]\.[a-z0-9]{2,10}(?:\.[a-z]{2,10})?$/.test(val)) {
   console.log('passed');
}

typscript version complete

//more info https://git.io/vhEfc
export const emailValid = (val:string):boolean => !/(\.{2}|-{2}|_{2})/.test(val) && /^[a-z0-9][a-z0-9-_\.]+@[a-z0-9][a-z0-9-]+[a-z0-9]\.[a-z]{2,10}(?:\.[a-z]{2,10})?$/.test(val);
improved formatting, fix link
Source Link
Vlad Bochenin
  • 3k
  • 1
  • 22
  • 34
Loading
Source Link
Loading
Post Made Community Wiki by Juan Pablo