Just to throw this out into the mix we have a Java class (and UDF library)
for validating email addresses at:
http://www.cfdev.com/email/

Besides checking syntax, and all valid TLD's it can also do a MX lookup
(DNS) to validate that the domain is indeed valid. And if you want to go
beyond that, you can also check the mail servers (without sending an email).

_____________________________________________
Pete Freitag
CTO, CFDEV.COM
http://www.cfdev.com/

-----Original Message-----
From: Paul Johnston [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 28, 2003 11:23 AM
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] Regular Expression for Email and Domain checking
- it works!


Spike,

> *snip*
>
> So this could be:
>
> ( This is an email address )paul( an end &&^%%% to the
> "$%�$%� email address as a comment \sdfsdfsdf )@pjnetsolutions.com
>
> Which you'll plainly agree is valid but completely silly!
>
> Taking the local-part quoted-string idea you could have:
>
> [CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS]
>
>  " "
>
> As a "valid" email or:
>
>  " There is nothing to stop this being valid email address "
> @pjnetsolutions.com
>
> Which also follows the spec!
>
> It all leads to a confusing and plainly quite silly regex
> when actually we know pretty much what we want.  Although one
> day I might actually try and do this!
>
> *snip*
>
> This is exactly the sort of thing that I started to run into
> when I had my supposedly all encompassing uber-regex-stack.
> It's actually quite tricky to strip all the stuff out of some
> of the email addresses people use.

I'd just never got round to looking at the spec.  It is amazing what some
people send as their email address it's true!

> Like I said, I found that it caused more problems than it
> solved and accepted that ultimately I would just have to
> accept a certain amount of rubbish in my email fields.
>
> I also found that having the password sent in a confirmation
> email helped to reduce the amount of dirty data.

Of course!  Simple and effective.

> That is, of course, a solution that was specific to the
> application that I was building, but it's worth considering
> nonetheless. It does really depend on why you are trying to
> validate an email address in the first place, but usually
> it's because you want to send an email to the user. In that
> case, you probably want to make sure the user has a good
> reason for putting the address in correctly ,such as getting
> the password for their account, or having it activated. Once
> you've done that, you really only want to check for typos
> which is something that can be done with a relatively simple
> regex for the majority of email addresses.

However, I do think I have provided several pretty simple regexes that do
the job and are spec compliant (at least to the point that they need to be).

> As I said though, this all depends on why you want to
> validate the email addresses in the first place, so you can
> take what you will from the above paragraph.

True.  Mainly because I wanted an all encompassing test for an email
address.  I'm actually more bothered that some servers on the internet do
not follow the domain standard, which doesn't allow for underscores (and I'm
sure I've seen them somewhere!)

Paul




--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to