Does anyone know a RegEx for checking if an e-mail is valid? It should be compatible with the following formats:
mailto:test@domain.tld
test@domain.tld
test_test.test@domain.tld
test@subdomain.domain.tld
test@123.123.123.123
...
Of course, it should return false for:
_test@domain.tld
test@subdomain1.subdomain2.domain.tld
a@b.c
...
I tried creating my own, but I am not very good at RegEx:
CODE
/^(?mailto:)?[A-Za-z0-9][A-Za-z0-9_\.\-]@[([A-Za-z0-9][A-Za-z0-9_\.\-])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})]\.[A-Za-z]{2,5}$/
The above doesn't seem to work well with subdomains and I am sure it has other problems since it's written by me.
Regards,
Sebastian
