Topic description
Determine if the input is in the correct mailbox format.
1 /* \. : matches . . \w : matches any word, character, including underscore. + : Match the previous character one or more times. * : Match the previous character zero or several times. */
2 // (1)
3 function isAvailableEmail(sEmail) {
4 var reg=/^[0-9a-z\._]+@[0-9a-z\._]+$/ ;
5 return reg .test(sEmail);
6 }
7
8 // (2)
9 function isAvailableEmail(sEmail) {
10 var reg = /^(\w)+(\.\w+)*@(\w)+((\. \w+)+)$/ ;
11 return reg.test(sEmail);
12 }