
     Using Text Expressions
     ----------------------
     
     A text expression specifies the text you want to search for.
     
     When you specify text to match, most characters are treated
     literally -- that is, an "a" just means the letter "a", and a "("
     means a left parenthesis.  For example, to search for the name
     "Mabel," just enter the word Mabel.

     You can also use a regular expression (see below) to specify the
     text.  Regular expressions provide a much more powerful matching
     tool than plain text, because they allow you to describe "patterns"
     of characters, not just literal text.
     
     If the text expression includes spaces you must surround it with
     double quotes, for example:
     
          "at home"
     
     To include a double-quote character within the expression, use the
     escape character (see below).  For example, to search for the
     string '3" length', you might use:
     
          "3^" length"
     
     
     Regular Expressions
     -------------------
     
     Certain characters, such as the wildcard characters * and ?, have a
     special meaning.  These special characters allow you to specify a
     text "pattern" to locate in the files you search.

     The special characters used in regular expressions are called
     "meta-characters" because they have a higher-level meaning than a
     plain text character.  The meta-characters used are:
          
          ?         Matches any single character except the end-of-line
                    character.  For example, a?c matches abc, axc, or
                    a#c.
          
          *         Matches any character or string except the end-of-
                    line character; it also matches no character.  For
                    example, a*c matches alphabetic, all plastic, or AC.
          
          [abc...]  Matches any character listed within the brackets
                    (called a character class).  In case-insensitive
                    searches, letters in a class include their upper or
                    lower case equivalent.  For example, [aBc] will
                    match a, b, c, A, B, or C for case-insensitive
                    searches, but only a, B, or c for case-sensitive
                    searches.
          
          [a-z]     Matches any character between the ends of the
                    range, including the end characters themselves,
                    using standard ASCII values.  You may need an ASCII
                    chart to understand unusual ranges.  For example,
                    the range [0-z] would also include many punctuation
                    characters.  You can enter the ends of a range in
                    either order.  For example, [z-a] is the same as [a-
                    z].
          
          [~abc...] Matches any character except those listed within
                    the brackets.  If a range is used, it will match
                    characters which are not part of the range. For
                    example, [~afw-z#] will match all characters except
                    a, f, w, x, y, z, and #.

          <         Matches only if the character or string occurs at
                    the beginning of the line.  For example, <app will
                    match apple but not happy.
          
          >         Matches only if the character or string occurs at
                    the end of the line.  For example, and> will match
                    hand but not handle.
     
     If you want to find a file that contains the string "noodles" you
     can just enter that string.  But what if you want to find any
     string that starts with n, has a vowel plus two additional
     characters following, and then ends in "les" (for example, needles,
     nestles, nettles, nibbles, nickles, niggles, nipples, nobbles,
     nodules, noodles, nozzles, nubbles, and nuzzles)?  You can do it
     with this regular expression pattern:
     
          n[aeiou]??les
     
     If you want to find all files that contains the words "breach" or
     "broach", you would use this expression:
     
          br[oe]ach
     
     Here are a few more examples:
          
          a*b            Matches a line which contains an a followed by
                         a b somewhere later in the line.  For example
                         the following lines would match:
             
                              The alphabet contains 26 letters.
                              Today is the day we go to the boat.
                              ABC
             
                         The following lines would not match:
             
                              The brown fox jumped over the lazy dog.
                              Boys will be boys.
          
          1[0-9][0-9]    Matches a line which contains a number between
                         100 and 199.
          
          <1[0-9][0-9]   Matches a line which begins with a number
                         between 100 and 199.
          
          <??1[0-9][0-9] Matches a line which contains a number between
                         100 and 199 in the third, fourth, and fifth
                         columns.
          
          Mabel[~i]      Matches a line which contains the word Mabel,
                         and where the next character after the word is
                         not an I.
          
          . [~ ^n]       Matches a line which contains a period, then a
                         space, then any character that is not a space
                         or end of line (see below for information on
                         the escape character, ^).
     
     Strings in square brackets are called "character classes".  Whether
     a character is interpreted as a meta-character depends on whether
     it's in a class, and sometimes on its relative position.
     
     Outside a class, the characters with special meanings are <, >, ?,
     *, [, and ].  The special characters used within classes, ~ and -,
     are interpreted as normal characters when they occur outside a
     class.  For example, outside a class, the pattern ab~c would be
     interpreted literally, with no special meaning for the ~.
     
     The ~ character only carries a special meaning when it is the first
     character in the class; otherwise it is taken literally.
     Characters which have a special meaning outside a class such as ?
     and * are interpreted as plain text characters when they occur
     within a class.  For example, the pattern [xyz*~] would match the
     characters x, y, z, *, or ~.
     
     If you need to include one of the meta-characters in your text you
     must precede the meta-character with the escape character, a caret
     (^).  For example, to search for the string Are you there?, you
     must use this pattern:

          Are you there^?
     
     For more details, and information on using the escape character to
     represent non-printing characters like Tab or Line Feed, see the
     Escape Character section below.
     
     
     Escape Character
     ----------------
     
     The escape character, a caret (^), is used to change the meaning of
     the following character or characters.  You can use it to include
     meta- characters (see the Regular Expressions section above) or
     non-printing characters (see below) in your search pattern or file
     name.
     
     If an Escape character precedes a meta-character, the
     meta-character is treated literally, as plain text.  For example,
     you would use ^? to search for a question mark.  To put a caret in
     the text, use two carets (^^).  (Note that the escape character is
     not the same as the ASCII ESC character.)

     The Escape character also lets you specify characters that normally
     can't be used within a search pattern because they are non-printing
     -- for example, the carriage return or line feed characters.
     The five escape sequences of this type are:
          
          ^t        Tab (ASCII 9) character.
          
          ^r        Carriage return (ASCII 13) character.
          
          ^n        Line feed (ASCII 10) character; during searches this
                    also matches a carriage return/line feed pair.
          
          ^ddd      Numeric ASCII character ddd (decimal). The next three
                    characters after the ^ are considered to be the
                    number, but a one- or two-digit number can be used
                    if the character that follows is not a valid decimal
                    digit.
          
          ^xdd      Numeric ASCII character ddd (hex). The next two
                    characters after the ^x are considered to be the
                    number, but a one-digit number can be used if the
                    following character is not a valid hex digit.
     
     If the Escape character is followed by a character other than the
     ones listed above, the Escape is ignored and the character after it
     is used literally, even if it is a meta-character.  Here are some
     more examples:
          
          ^[Boot^]       Searches for [Boot].
          
          abc^ndef       Searches for abc at the end of one line
                         followed by def at the start of the next line.
          
          3 ^^ 6         Searches for 3 ^ 6.


