I have this regex for email validation (assume only [email protected], [email protected], [email protected] are valid)
/^[a-zA-Z0-9]+@[a-zA-Z0-9]\.(com)|(edu)|(org)$/i
But @abc.edu and [email protected] are both valid as to the regex above. Can anyone explain why that is?
My approach:
there should be at least one character or number before @
then there comes @
- there should be at least one character or number after @ and before .
- the string should end with either edu, com, or org.