As far as I know you can't in find operations, although you can in replace operations.
Find with selecting found string is a poor way to do a replace – it's slow and cumbersome – although it can be the only way to accomplish jobs under some circumstances.
The better way is to use replace (if it works for that job):
-------------------------------------------------------------------------------------------
tell application "BBEdit"
replace "MATCH" using "REPLACE" options {search mode:grep, case sensitive:false, starting at top:true}
end tell
-------------------------------------------------------------------------------------------
Otherwise you may have to do something like this:
-------------------------------------------------------------------------------------------
tell application "BBEdit"
tell front document
set foundTextRecord to find "<h3>\\s*(.*?)\\s*</h3>" options {
search mode:
grep,
starting at top:
true}
with selecting match set foundText to found text of foundTextRecord
set parsedText to replace "<h3>\\s*(.*?)\\s*</h3>" searchingString foundText using
"\\1" options {search mode
:grep, case sensitive
:false, starting at top
:true} end tell
end tell
-------------------------------------------------------------------------------------------
And that's why I generally prefer to use the Satimage.osax for find and find/replace operations.
-------------------------------------------------------------------------------------------
# Requires the Satimage.osax
-------------------------------------------------------------------------------------------
set _text to bbeditFrontWinText()
try
set parsedText to find text "<h3>\\s*(.*?)\\s*</h3>" in
_text using
"\\1" with regexp
and string result
without all occurrences
on error
set parsedText to false
end try
if parsedText ≠ false then
# DO SOMETHING
end if
-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on bbeditFrontWinText()
tell application "BBEdit"
tell front document to its text
end tell
end bbeditFrontWinText
-------------------------------------------------------------------------------------------
Although I will often turn to a Perl, awk, or sed text filter when it's efficient to do so.