Click to See Complete Forum and Search --> : Need a comprehensive e-mail validation check.


gsb
06-14-2003, 12:53 PM
I need a comprehensive e-mail validation check.
Anyone willing to share a good one?
Mine seems to be failing on some valid addresses.

jeffmott
06-14-2003, 02:10 PM
I'm assuming you mean syntax checking.../^[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)*\@[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)+$/This is derived from RFC822: Standard for ARPA Internet Text Messages. However, when this regex was first introduced on this forum it was generally consented that it was too laxed. The two places where the pattern above deviates from the specification are:

( local-part "@" domain )

1. The specification for the local-part allows the special characters that are normally not allowed if it is quoted. So for instance, ":sysmail"@Some-Group.Some-Org would be a valid address but be rejected by the above regex.

2. The above pattern requires at least one period followed by at least one other valid character in the domain. However, the specification does not require any period to be present in the domain. For example, emladdr@localhost is a valid address, but would be rejected by the above pattern.

These are the only two places where the rx does not return what it technically should. However, these situations rarely arise. I personally have never seen either type of address. So odds are good you will never encounter problems with them.

gsb
06-14-2003, 02:39 PM
Thanks.
I'll give it a try.