Reputation: 15692
var regex = /^[a-z\-A-Z_0-9]{1,}\u0040[_\-0-9a-zA-Z]{1,65}\.[a-zA-Z]{2,}$/;
document.write(regex.check("[email protected]"));
Upvotes: 0
Views: 89
Reputation: 18522
Your code doesn't output anything, becase the check method doesn't exist in RegExp. You should use RegExp.test method
Upvotes: 4
Reputation: 288290
.{0,0}
does not match anything (i.e. you probably want to start with ^
and end with $
). And you do not allow [email protected]
. You should probably read the stackoverflow question about the best email regex.
Upvotes: 3