Programmer's WorkBench (pwb.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Non-UNIX Matching Method
                                             Up Contents Index Back
─────Programmer's WorkBench─────────────────────────────────────────────────
 
     The type of non-UNIX matching method is significant only when you
     use a find-and-replace command. The matching method refers to the
     technique used to match repeated expressions. For example, does
     'a*' match as few or as many characters as it can? The answer
     depends on the matching method.
 
     PWB supports two matching methods:
 
       ■  "Minimal matching" matches as few characters as possible to
          find a match. Minimal matching is specified by the '*' and '+'
          characters.
 
          For example, 'a+' matches only the first character in
          'aaaaa'. However, 'ba+b' matches the entire string 'baaaab'
          because it is necessary to match every 'a' to match both
          occurrences of 'b'.
 
       ■  "Maximal matching" matches as many characters as possible.
          Maximal matching is specified by the '@' and '#' characters.
 
          For example, 'a#' matches the entire string 'aaaaaa'.
 
     Example
 
     If 'a+' (minimal matching plus) is the search string and 'EE' is
     the replacement string, PWB replaces 'aaaaa' with 'EEEEEEEEEE'
     because at each occurrence of 'a', PWB immediately replaces it
     with 'EE'.
 
     However, if 'a#' (maximal matching plus) is the search string, PWB
     replaces the same string with 'EE' because it matches the entire
     string 'aaaaa' at once and replaces that string with 'EE'.
                                    -♦-