I am a total beginner and have written a few little scripts that feed use Applescript to feed BBEdit a list of find and replace fields, primarily for formatting. I.e. convert to tag1, tag2, etc.
I'm trying to use the same method to replace some numbers so find 9 replace with 1. It only works if the number has a space either side. I.e. tag9 9, is replaced with tag9 1. I wondered if someone could tell me why?
Here is my script:
set line1replaceList to {{"0", "1"}, {"9", "1"}, {"8", "1"}, {"7", "1"}, {"6", "1"}, {"5", "1"}, {"4", "1"}, {"3", "1"}, {"2", "1"}}
tell application "BBEdit"
tell window 1
repeat with thePair in line1replaceList
replace (item 1 of thePair) using (item 2 of thePair) options {starting at top:true, case sensitive:false, match words:true, search mode:grep}
# Check the "Search Options" in TextWrangler's scipting dictionary!
end repeat
end tell
end tell
Thanks in advance for your help.
Tom
Get rid of the "match words" part and it should work. In fact, you don't need the grep part, either.
So the line would be:
replace (item 1 of thePair) using (item 2 of thePair) options {starting at top:true, case sensitive:false}