I have this regex for email validation (assume only x@y.com, abc@defghi.org, something@anotherhting.edu are valid)
/^[a-zA-Z0-9]+@[a-zA-Z0-9]\.(com)|(edu)|(org)$/i
But @abc.edu and abc@xyz.eduorg 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.