On Jan 26, 2011, at 07:41, Doug Pinkerton wrote: > Thanks, Chris. Unfortunately, the email addresses are not on lines by > themselves, so "Process lines containing..." copies all of the data on the > line. The result is simply a copy of the original document. Strictly > speaking, although I view it with soft wrap, it's all one line, since there > are no returns in this document. Any other suggestions? ______________________________________________________________________
Hey Doug, Whups. I was rather short-sighted when I tested... This is what *I* would do (script below). It *is* dependent upon the Satimage.osax though (a 3rd party osax: http://tinyurl.com/dc3soh I'm sure one of the Perl guys will offer a nicely terse solution, but this works fine on a more complex test file than I used first time around. You can run it from the Applescript Editor or save as a compiled script and run from BBEdit's script menu. It expects your document to be frontmost in BBEdit and will produce output to a new window. -- Best Regards, Chris ################################################################################################ on regexFindCapture(fndStr, returnStr, dataSource, caseSensitive, regexFlag, wholeWord, allOccurrences, stringResult) try set findResult to find text fndStr ¬ in dataSource ¬ case sensitive caseSensitive ¬ regexp regexFlag ¬ whole word wholeWord ¬ using returnStr ¬ all occurrences allOccurrences ¬ string result stringResult return findResult on error # errMsg number errNum return false end try end regexFindCapture ################################################################################################ on getBBEditText() tell application "BBEdit" try set bbText to text of front text window return bbText on error errMsg number errNum set sep to "==============================" set e to sep & return & "Error: " & errMsg & return & sep & return ¬ & "Error Number: " & errNum & return & sep beep display dialog e end try end tell end getBBEditText ################################################################################################ on makeOutPutWindow(outPutText) tell application "BBEdit" try make new text window with properties {text:outPutText} activate on error errMsg number errNum set sep to "==============================" set e to sep & return & "Error: " & errMsg & return & sep & return ¬ & "Error Number: " & errNum & return & sep beep display dialog e end try end tell end makeOutPutWindow ################################################################################################ set bbText to getBBEditText() set extractEmails to regexFindCapture("(<[^@]+@[^@]+?>)", "\\1", bbText, false, true, false, true, true) set extractEmails to sortlist extractEmails comparison 2 set extractEmails to join extractEmails using return makeOutPutWindow(extractEmails) -- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at <http://groups.google.com/group/bbedit?hl=en> If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
