REGEXP MODULE - regexp.pm
The regexp module allows Perl regular expression replacement to be done with filepp. Its file name is regexp.pm.

Perl regular expression replacement allows a regular expression to be searched for and replaced with something else. Regular expressions are defined as follows:

#regexp /regexp/replacement/
    It is very similar to the Perl syntax and the following Perl code will be executed on each line of the input file:

$line =~ s/regexp/replacement/g
    For users who don't understand Perl, this means replace all occurrences of regexp in the current line with replacement.

A full description of regular expressions and possible replacements is beyond the scope of this man page. More information can be found in the Perl documentation using the command:

perldoc perlre

Any number of regular expressions can be defined. Each regular expression is evaluated once for each line of the input file. Regular expressions are evaluated in the order they are defined.

Regular expressions can be undefined in the following way:

#rmregexp /regexp/replacement/
    This will remove the specified regular expression.

In debugging mode the current list of regular expressions can be viewed using the pragma keyword:

#pragma filepp ShowRegexp
    When not in debugging mode, this will produce no output.

A single regular expression can also be defined on the command line using the REGEXP macro, for example:

filepp -DREGEXP=/regexp/replacement/ -m regexp.pm inputfile

Note: the REGEXP macro must be defined BEFORE the regexp module is loaded, putting -DREGEXP... after -m regexp.pm will not work. When using the command line approach, if the REGEXP macro is successfully parsed as a regular expression it will be undefined from the normal filepp macro list before processing starts. Care should obviously be taken when escaping special characters in the shell with command line regexps.