MACSCRPT Archives

December 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
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:
Macintosh Scripting Systems <[log in to unmask]>
Subject:
From:
Emmanuel <[log in to unmask]>
In-Reply-To:
<p06002010c19a3a0095a3@[10.101.105.169]>
Content-Transfer-Encoding:
quoted-printable
Sender:
Macintosh Scripting Systems <[log in to unmask]>
Parts/Attachments:
text/plain (48 lines)
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

ATOM RSS1 RSS2