I have this regex that checks the validity of an email address
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})开发者_开发技巧$/;
I want to tweak it so it ensures the email address entered is an .edu account.
PS - It's not for homework, I swear.
Change ([A-Za-z]{2,4})
into [Ee][Dd][Uu]
.
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.[Ee][Dd][Uu]$/;
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.(edu)$/i;
精彩评论