I have been having a great deal (weeks) of trouble with the find
command. I can find one instance of a pattern in a text file
containing multiple instances, but I must use the option "starting at
top". This won't work inside a loop so I had to decipher the structure
of the "found matches" record of the "Search Match" record of "find"
using error messages in XCode.
set aMatch to find thePattern searching in fileRef options {search
mode:grep, starting at top:true, returning results:true} without
selecting match
set theMatches to found matches of aMatch
repeat with i from 1 to (count of theMatches)
set aString to (message of record i of theMatches) as Unicode text
-- work with a list
end repeat

This doesn't quite work either: The returned strings do contain the
pattern but they also contain text on either side of the pattern. The
pattern works in a simple search of the file using BBEdit directly but
not in a search using BBEdit 9 in Applescript.

pattern: "ged2html/d\\d{4}/g\\d{7}.html#I\\d+" used in Applescript
application
(\r and \t represent <return> and <tab> characters)
sample text: '  <li>\r\t<a href="../ged2html/d0000/
g0000083.html#I1267">Chauvin Isabelle Marie</a>\r\t</li>'
expected results: 'ged2html/d0000/g0000083.html#I1267'
actual results: '\t<a href="../ged2html/d0000/
g0000083.html#I1267">Chauvin Isabelle Marie</a>'

 Can anyone explain this? What about a workaround?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
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 specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to "[EMAIL PROTECTED]" 
rather than posting to the group.
-~----------~----~----~----~------~----~------~--~---

Reply via email to