I have a simple regex that I use in my MS Access database to validate email addresses. Here is the VBA:
strEmailRegex = "^[a-zA-Z][\w\.-]*[a-zA-Z0
However, any email address with a 1 character domain name fails the regex. Ie, "firstname.lastname@example.org" fails. Can someone adjust the regex above to allow one character domains.
Also, I'm not sure the current rules on domain names. It seems like one character domains are allowed (q.com and z.com) though they are not very common (most of the ones I tried failed). Trying to register a.com on GoDaddy just says "a.com is an invalid domain name." What domains are and are not allowed?
strEmailRegex = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"