Programmer's WorkBench (pwb.hlp) (Table of Contents; Topic list)
Tagged Regular Expressions
 Example                                   Up Contents Index Back
─────Programmer's WorkBench─────────────────────────────────────────────────
 
     Tagged expressions are regular expressions enclosed by '\(' and
     '\)' (UNIX) or '{' and '}' (non-UNIX). Use tagged expressions to
     match repeated elements and to mark substrings for use in a
     replacement.
 
     When you specify a regular expression with tagged subexpressions,
     PWB finds text that matches the regular expression and marks each
     substring matching a tagged subexpression. For example, the UNIX
     regular expression
 
          \(<\)\([^>]+\)\(>\)
 
     matches the string
 
          <bracketed>
 
     and tags the '<', 'bracketed', and '>' substrings.
 
     To refer to tagged text in a find or replacement pattern, use '\n'
     (UNIX) or '$n' (non-UNIX), where <n> is the number of a tagged
     subexpression from 1 to 9. In a find pattern, this reference
     matches another occurrence of the previously matched text, not
     another occurrence of the regular expression. In a replacement,
     PWB uses the matched text.
 
     The entire match is implicitly tagged for use in replacement text.
     Use '\0' (UNIX) or '$0' to refer to the entire match. For example,
     the UNIX find pattern
 
          ^\([^ ]+\) +\([^ ]+\).*
 
     with the replace pattern
 
          \2 \1 (\0)
 
     matches lines without leading spaces and at least two words. It
     replaces them with lines that consist of the transposed words
     followed by the original line in parentheses.
 
     See
 
     Aligning Tagged Expressions
                                    -♦-