Mime-Version: |
1.0 |
Content-Type: |
text/plain; charset="iso-8859-1" ; format="flowed" |
Date: |
Mon, 4 Dec 2006 23:22:15 +0100 |
Reply-To: |
|
Subject: |
|
From: |
|
In-Reply-To: |
<p06002010c19a3a0095a3@[10.101.105.169]> |
Content-Transfer-Encoding: |
quoted-printable |
Sender: |
|
Parts/Attachments: |
|
|
At 3:54 PM -0500 12/4/06, Jeramey Valley wrote:
>I have a list of email addresses*. Some of the addresses in the list
>are not of correct form, meaning they may have a space, extra period
>or other no-no in the address.
>
>Examples:
>
>someDude@gmail..com
>my name@my company.com
>
>What's the best way to test and fix the errors in this list?
>
>My plan was to use the regex function in the Satimage addition and
>perform a pattern replace. I would be creating the pattern from
>scratch.
>
>Has anyone gone through and created the most common pattern matches
>they would like to share or have a better solution?
I would advise using Apple's strategy, which checks first that it
"looks like" an e-mail address, then searches for gremlins. That's at
<http://developer.apple.com/internet/webcontent/validation.html>, but
it's javascript.
We use the following variante:
on isvalidemail(x)
try
ufind text "[log in to unmask]\\..{2,3}$" in x with regexp
on error
return false
end try
try
ufind text
"[áàâäéèêëíìîïóòôöúùûüÿ()<>,;:\\\\/\"\\[\\]]" in x with regexp
return false
end try
return true
end isvalidemail
Be aware that nothing is easier than finding lots of invalid
addresses which will return true: for instance, addresses with kanji.
Emmanuel
|
|
|