On Sep 18, 2008, at 5:25 PM, Michael Richards wrote: > A test sample comes from an html file: > <h2 class="indiv"><a name="I1267"></a> Chauvin Isabelle Marie</h2> > > The applescript that used to work contains the line: > set aMatch to (find "name=.I\\d+" searching in (text 1 of text > document 1) options {search mode:grep} with selecting match) > The Applescript opens a folder full of html files and does examine > the file in question but fails to match the pattern.
Michael, This script behaves identically for me both in 9.0.1 and 8.7.2. set zContents to "<h2 class=\"indiv\"><a name=\"I1267\"></a> Chauvin Isabelle Marie</h2>" tell application "BBEdit" make new text document with properties {contents:zContents} set zMatch to (find "name=.I\\d+" searching in (text 1 of text document 1) options {search mode:grep with selecting match) zMatch end tell In both cases, it fails to find a match. Why? Because find starts searching from the insertion and stops at the first match, or the end of the document, when it isn't other explicit options. In my example, the insertion point is wherever BBEdit left it after the create operation. If I had opened a document, the insertion point may be at the top if there is no saved selection range, or it may be at some other indeterminate point in the file. The way out of this is to specify wrap around if you are just looking for one match, and you don't care where it is, or, more probably, if you are working in a loop, specify "starting at top: true" in the options for the first loop iteration, and false for subsequent iterations. - Jim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To post to this group, send email to bbedit@googlegroups.com 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. -~----------~----~----~----~------~----~------~--~---