• 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: Searching a Mail message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching a Mail message


  • Subject: Re: Searching a Mail message
  • From: Philip Aker <email@hidden>
  • Date: Sun, 3 Jun 2007 07:26:29 -0700

On 2007-06-02, at 13:52:38, Doug McNutt wrote:

<http://www.regular-expressions.info/email.html>

Nice link Doug,

I did a variant of the short form in Tcl and it works remarkably well.

However, for the purposes of using it to grab email addresses from an arbitrary Mail message (using Luther's 'content of'), the results, although generallly better than Deivy's, are not 100% accurate and in some cases return nothing when one can clearly see there is a valid email address in the content.

Neither is using 'source of' because then it will also return all @s in the headers. Change 'content of' to 'source of' to see the difference.


tell application "Mail" to set m to (content of item 1 of (get selection)) as text
set res to {}
set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, space}
set res to text items of (do shell script "echo 'puts [lsort -dictionary -unique [regexp -all -nocase -inline -- {[0-9A-Z._%-]+@[0-9A-Z.-]+[A-Z]{2,4}} {'" & quoted form of m & "'}]]' | tclsh")
set AppleScript's text item delimiters to tids
res

Philip Aker
email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Searching a Mail message (From: Jeffers <email@hidden>)
 >Re: Searching a Mail message (From: Luther Fuller <email@hidden>)
 >Re: Searching a Mail message (From: Michelle Steiner <email@hidden>)
 >Re: Searching a Mail message (From: Luther Fuller <email@hidden>)
 >Re: Searching a Mail message (From: Michelle Steiner <email@hidden>)
 >Re: Searching a Mail message (From: Doug McNutt <email@hidden>)

  • Prev by Date: Re: Searching a Mail message
  • Next by Date: Re: Searching a Mail message
  • Previous by thread: Re: Searching a Mail message
  • Next by thread: Re: Searching a Mail message
  • Index(es):
    • Date
    • Thread