Wow, you are a god -- that's a great way to do it. Thanks very much!
On Aug 6, 2007, at 8:25 AM, Peter N Lewis wrote:
tell application "BBEdit"
replace "(.+)" using "<a href='http://affiliates.jlist.com/click/
19?url=http://www.jlist.com/redirected.php?SEARCH/MARKHERE\
\1MARKHERE' target='New'>\\1</a>" searching in selection of text
window 1 options {search mode:grep, starting at top:false, wrap
around:false, backwards:false, case sensitive:false, match
words:false, extend selection:false}
repeat while 1 = (replace "MARKHERE(.+) (.+)MARKHERE" using
"MARKHERE\\1_\\2MARKHERE" searching in selection of text window 1
options {search mode:grep, starting at top:false, wrap
around:false, backwards:false, case sensitive:false, match
words:false, extend selection:false})
end repeat
replace "MARKHERE(.+)MARKHERE" using "\\1" searching in selection
of text window 1 options {search mode:grep, starting at top:false,
wrap around:false, backwards:false, case sensitive:false, match
words:false, extend selection:false}
end tell
Basically, do your replace as before, but instead of the first \\1,
replace with MARKHERE\\1MARKHERE. The text MARKHERE can be
anything, and the two can be different, as long as they don't match
anything in the search text and they are kept consistent in the
following searches.
Then repeat searching for MARKHERE(.+) (.+)MARKHERE and replacing
the space with _. Repeat until no matches are found.
Then remove the MARKHERE marks and you're done.
Enjoy,
--
You've got a friend in Japan
http://www.jlist.com