User:Eschaal/PPTools/Mac/jeebie.scpt
The Jeebie.scpt is an Applescript used by TextWrangler to search for all instances of the words "he," "be," "is," and "as," for easy checking for possible "he/be" and "is/as" errors.
The Grep expression used in this script uses the word boundary marker and the OR symbol to search for the word "he" or "be" or "is" or "as." One note about Applescripts and Grep, in Applescripts the forward slash "\" is used to identify tokens. In order for Grep searches to be scriptable, the forward slash needs to be doubled. For instance, the return symbol "\r" in AppleScript is "\\r", and the word boundary marker "\b" becomes "\\b".
Notice that this script is heavily commented for ease of understanding, and that this script uses one function "do_Grep_Find," which has two parameters. The first parameter is "searchWith," which is the Grep expression used in the search. The second parameter is "targetWindow," which is the top text window.
The advantage of using a function, like "do_Grep_Find," is that it makes it easier to reuse the coding in this script or in other scripts, focusing on what is different (the Grep script used), and reducing the chance of inadvertent error entered in the search term.
The result of this script is to produce a search results window with each instance of the words "he," "be," "is," and "as," so that one can scroll through the results and see how each instance of the words are used within context.
The code of this script is listed here