Re: How to extract the email address in a the message body
Re: How to extract the email address in a the message body
- Subject: Re: How to extract the email address in a the message body
- From: Joseph Weaks <email@hidden>
- Date: Mon, 8 Nov 2004 10:58:43 -0600
On Nov 8, 2004, at 10:17 AM, Randal L. Schwartz wrote:
"Joseph" == Joseph Weaks <email@hidden> writes:
Joseph> How is "this-- part of the addy? You can't have a space in a
valid addy.
You sure can if it's between tokens. Ahh, right, you'd
need a period there.
So blah-- . fred&barney @ stonehenge . com is a legal
address. But without the "dot", it wouldn't be.
Well, I'm sure you're correct, but anyone who writes their addy like
that doesn't deserve to be in my database. :) You're right that a 100%
correct extractor is all but impossible.
The simplest solution, the one I made using space as a delimiter, would
even be confused with "email@hidden, blah blah" or
"email@hidden,email@hidden". (I would say stay away from Applescript's
understanding of "word", because it will leave out quite a bit.)
If one can ignore your exception where spaces are included in the addy,
I'd begin with:
tell app "mail.app" to set theBody to --er... content of selected
message... forget the syntax
set Applescript's text item delimiters to " "
set theList to text items of theBody
repeat with thisChunk in theList
-- get a list of possible email addy occurences and begin trapping,
like:
repeat while last item of thisChunk is in {"?", ".", ",", "\""} --etc.
set thisChunk to text 1 thru -2 of thisChunk
end repeat
-- then process thisChunk
end
Joe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden