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.
Regular Expressions in Macro Strings
                                             Up Contents Index Back
─────Programmer's WorkBench─────────────────────────────────────────────────
 
     When writing a searching macro that uses regular expressions, note
     that the backslash character is used in both the macro string
     syntax and regular expression syntax. This means that every
     backslash in the regular expression must be doubled within the
     macro string.
 
     For example, the following macro uses a regular-expression find-
     and-replace operation to adjust each line continuation (backslash
     at the end of a line) so that it appears in column 73.
 
          SlashJust:=Savecur Begfile Arg Arg Replace    \
                     "^\\(.*[^ ]\\)  +\\\\$" Newline    \
                     "\\(-70,1)  \\\\" Newline Restcur
 
     Note that the literal backslash at the end of each string is
     specified with four backslashes: doubled once to escape it in the
     regular expression and doubled again to escape it in the macro
     string.
 
     See
 
     Macro String Syntax
     Regular Expressions
                                    -♦-