Some extra suggestions for using the grep capabilities of BBEdit Lite 4.x

[last updated 9/30/99]

The files "BBEdit Lite Quickstart" (found in the BBEdit Lite folder in older versions of the program), and the "BBEdit Lite User Manual" (found with newer versions of the program) provide a number of useful tips on how to use 'grep' search capabilities to perform powerful searches. However, here are some additional notes, suggestions etc.

Note: single quotes here enclose strings to search for or strings to use in making your searches&endash;they are not supposed to be part of the search pattern.

  1. To look for any one of a set of items, use the symbol |', i.e. to search for lines containing either 'did' or 'does' you can search for 'did|does'.
  2. If you area searching on the results of a search, beware of searching for the string 'am': since it is part of Adam's name, you'll need to make the search case sensitive to avoid zillions of matches to the string 'AM'.
  3. The symbol '?' has a special meaning for grep; to actually search for a question mark, put a backslash '\' before the question mark, e.g. to search for questions by Adam, search for the string '\*ADA.*\?'
  4. The string 'is' is part of commonly occurring words like 'this' and 'his', which you don't want to find in your searches. To search for just the word 'is' you can require that the string is preceded by one character of white space '[ ]', i.e. search for the string '[ ]is'. Note: the use of '[ ]' seems not to work in version 4.6 of BBEdit Lite - you should instead use the expression '\s' to refer to a whitespace character. See the User Manual for more information on special characters like these.
  5. So to search for instances of 'is' in Adam's speech, search for '\*ADA.*[ ]is' (earlier versions), or '\*ADA.*\sis' (version 4.6).
  6. Starting to put some of this together: you can look for the word 'is' spoken by Adam in a sentence containing 'ing' by searching for the string '\*ADA.*[ ]is.*ing'. [replace '[ ]' with '\s' in version 4.6]
  7. In order to specify that parts of the search string may be either adjacent or non adjacent, you can use the expression [.?]: the period means 'anything', and the question-mark means 'zero or one occurrences of what I follow'.
  8. Therefore, to look for instances of Adam using 'is' followed by 'ing' in a question, search for '\*ADA.*[ ]is.*ing.*\?' [replace '[ ]' with '\s' in version 4.6]
  9. [contributed by Jennifer Johnson] To search for any one of a number of words in just one speaker's utterances, e.g. any of 'am', 'is' etc. in Adam's utterances, use something like the following: '\*ADA.*[ ]am|\*ADA.*[ ]is|...(etc.)' Nina Kazanina points out that this can be simplified by using parentheses, to: '. \*ADA.*(\sis|\sare|...)' This simplification seemed not to be possible in earlier versions of BBEdit Lite - this may be related to the change involving '[ ]' and '\s'.
  10. [contributed by Jason Lilley] A tab is not a space. There is a tab in each line between the label and the utterance. So if you search for a word by searching for '[ ]be[ ]' for instance, you will find all occurrences of the word 'be' with a space before and after it, but not if it was the first word of the sentence. (The brackets are used to find spaces.) The match pattern for a tab is \t. So you can use: '([ ]|\t)be[ ]'