• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to extract the email address in a the message body
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • AppleScript isn't the same today?
      • From: Jason Bourque <email@hidden>
References: 
 >How to extract the email address in a the message body (From: Leon Chen <email@hidden>)
 >Re: How to extract the email address in a the message body (From: Daniel Todd Currie <email@hidden>)
 >Re: How to extract the email address in a the message body (From: Leon Chen <email@hidden>)
 >Re: How to extract the email address in a the message body (From: email@hidden (Randal L. Schwartz))
 >Re: How to extract the email address in a the message body (From: Joseph Weaks <email@hidden>)
 >Re: How to extract the email address in a the message body (From: email@hidden (Randal L. Schwartz))

  • Prev by Date: Re: How to extract the email address in a the message body
  • Next by Date: AppleScript isn't the same today?
  • Previous by thread: Re: How to extract the email address in a the message body
  • Next by thread: AppleScript isn't the same today?
  • Index(es):
    • Date
    • Thread