Note that these are very plain-jane; I'm not doing error-checking for unmatched patterns, etc.
------------------------------------------------------------------------------------------------
tell application "BBEdit"
tell text of front text document
set _text to quoted form of (get its contents)
set its contents to do shell script "echo " & _text & " | tr '\\r' '\\n' | egrep -iv \"believe|entirely\""
end tell
end tell
------------------------------------------------------------------------------------------------
# My usual preference using the
Satimage.osax, although the process-lines routing is very straightforward.
# I like using it because it's a very familiar tool, and I have very fine control over what it does.
------------------------------------------------------------------------------------------------
on fnd(findStr, srcData, caseSensitive, allOccurrences, stringResult)
try
set findResult to find text findStr in srcData ¬
case sensitive caseSensitive ¬
all occurrences allOccurrences ¬
string result stringResult ¬
with regexp
return join findResult using return
on error
return false
end try
end fnd
------------------------------------------------------------------------------------------------
tell application "BBEdit"
tell text of front text document
set its contents to my fnd("^.*(essential|power).*", (get its contents), false, true, true)
select insertion point before character 1
end tell
end tell
------------------------------------------------------------------------------------------------
# Also using the Satimage.osax but without the handler.
------------------------------------------------------------------------------------------------
tell application "BBEdit"
tell text of front text document
set its contents to join (find text "^.*(essential|power).*" in (get its contents) ¬
regexp true ¬
case sensitive false ¬
all occurrences true ¬
with string result) using return
select insertion point before character 1
end tell
end tell
------------------------------------------------------------------------------------------------