HP 3000 Manuals

Search String Commands [ HP FORTRAN 77/iX Migration Guide ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Migration Guide

Search String Commands 

Search string commands are those that appear on the left side of the
command.

The following characters are interpreted as commands if they precede a
search string, unless they are themselves preceded by a backslash
character (\).

Position Expressions 

   ^          search string starts at beginning of line

   $          search string ends at end of line

   ^nnn       search string starts at column nnn 

   $nnn       search string ends at (last column - nnn)

   <nnn       search string starts in any column before nnn 

   >nnn       search string starts in any column after nnn 

   \          don't interpret the next character as a command

Tag Fields 

   {expn}     "Remember" the text matched by the expression expn for use
              in the replacement string.

   a&b        Match a string delimited by evenly nested occurrences of a
              and b (which can be any two characters), and also
              "remember" the contents for use in the replacement string.

Example.   

     R/(&)//[wow]/

This command replaces any set of characters delimited by parentheses with
the string [wow].  For example, if a source line contained the string
(hi(people)), the migration aid would replace it with [wow].

Character Classes 

   [set]      Match any character in set, which is defined as

                 *   specific list of characters (as, for example, [abde]
                     or [ab012&"@]), or

                 *   range of characters, the first separated from the
                     last by a hyphen (as, for example, [a-z] or [0-9]),
                     or

                 *   mixture of the two.

   [^set]     Match any characters except those in set, which is as
              defined above.

Examples.   

   [a-gxyz]     is the set abcdefgxyz

   [a-zA-Z]     is the complete set of alphabetic characters

   [^0-9]       is anything but a digit

Closures 

   *          Match zero or more occurrences of the preceding character
              or character class (but do not match anything else).

   *nnn       Match exactly nnn occurrences of preceding character or
              class.

   +nnn       Match at least nnn occurrences of preceding character or
              class.

   ?nnn       Match up to nnn occurrences of preceding character or
              class.

   .          Match any single character.

   @          Match any string until the next character is found.

Examples.   

The following command converts all occurrences of the string ACCEPT to
the string READ *,.

     G/{@}ACCEPT//&1READ \*,/

The following command converts only the first occurrence of the string
ACCEPT to the string READ *,.

     R/{@}ACCEPT//&1READ \*,/



MPE/iX 5.0 Documentation