Programmer's WorkBench (pwb.hlp) (Table of Contents; Topic list)
UNIX Regular Expressions
 Summary                                   Up Contents Index Back
─────Programmer's WorkBench─────────────────────────────────────────────────
 
     PWB uses the following UNIX-style regular-expression syntax:
 
     Syntax         Description
 
     \c             Escape: matches a literal occurrence of the
                    character <c> and ignores any special meaning of
                    <c> in a regular expression.
 
                    For example, the expression '\?' matches a question
                    mark '?', the expression '\^' matches a caret '^',
                    and the expression '\\' matches a backslash '\'.
 
     .              Wildcard: matches any single character.
 
                    For example, the expression 'a.a' matches 'aaa',
                    'aBa', and 'a1a' but not 'aBBBa'.
 
     ^              Beginning of line.
 
                    For example, the expression '^The' matches the word
                    'The' only when it occurs at the beginning of a
                    line.
 
     $              End of line.
 
                    For example, the expression 'end$' matches the word
                    'end' only when it occurs at the end of a line.
 
     [class]        Character class: matches any one character in the
                    class. Use a dash (-) to specify ranges. Within a
                    class, all characters except ^-\] are treated
                    literally.
 
                    For example, '[a-zA-Z0-9]' matches any character or
                    digit, and '[abc]' matches 'a', 'b', or 'c'.
 
     [^class]       Inverse of character class: matches any character
                    not specified in the class.
 
                    For example, [^0-9] matches any character that is
                    not a digit.
 
     x*             Repeat operator: matches zero or more occurrences
                    of <x>, where <x> is a single character, a
                    character class, or a set of regular expressions
                    specified with the alternation syntax.
 
                    For example, the regular expression 'ba*b' matches
                    'baaab', 'bab', and 'bb'. This operator always
                    matches as many characters as possible.
 
     x+             Repeat operator (shorthand for xx*): matches one or
                    more occurrences of <x>.
 
                    The regular expression 'ba+b' matches 'baab' and
                    'bab' but not 'bb'.
 
     \(x\)          Tagged expression: marked text, which you can refer
                    to as '\n' elsewhere in the find or replacement
                    string. Within a find string, PWB finds text that
                    contains the tagged text. Within a replacement
                    string, PWB reuses the matched text in the
                    replacement.
                    See: Tagged Regular Expressions
 
     \n             References the characters matched by a tagged
                    expression, where <n> is a one-digit number and
                    indicates which expression. The first tagged
                    expression is '\1', the second is '\2', and so on.
                    The entire expression is represented as '\0'.
                    See: Tagged Regular Expressions
 
     \{x\}          Grouping. Groups a regular expression so that you
                    can use a repeat operator on the subexpression.
 
                    For example, the regular expression '\{Test\}+'
                    matches 'Test' and 'TestTest'.
 
     \{x\!y\!z\}    Alternation: matches one from a set of alternate
                    patterns. The alternates are tried in left-to-right
                    order. The next alternate is tried only when the
                    rest of the pattern fails.
 
                    For example, '\{ +\!$\}' matches a sequence of
                    blanks or the end of a line.
 
                    TIP: To match zero or one occurrences of a pattern,
                         use alternation with an empty alternative:
 
                              \{x\!\}
 
                         This specifies one occurrence of <x> or
                         nothing.
 
     \~x            "NOT" function: matches nothing but checks to see
                    whether the text matches <x> at this point and
                    fails if it does.
 
                    For example, '^\~\{ \!$\}.*' matches all lines that
                    do not begin with white space or end of line.
 
     \:e            Predefined regular expression, where <e> is a
                    letter specifying the regular expression.
                    See: Predefined Regular Expressions
 
     See
 
     UNIX Regular Expression Examples
                                    -♦-