The first validation check parses for common invalid syntax that would pass very basic email checks that simply look for @ and .
var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
Along with this, the first part of the if statement checks to make sure the input does NOT match these common regular expression patterns.
if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
The second validation check parses for valid syntax. The regular expression pattern matches the basic syntax of a valid e-mail address, according to the following rules (in order of appearance):
1.One or more characters before the "@" 2.An optional "[", because user@[255.255.255.0] is a valid e-mail 3.A sequence of letters, numbers, and periods, which are all valid domain or IP address characters 4.A period followed by a 2-3 letter suffix 5.An optional "]"
Your e-mail address: Subject: Comments: