REGEXP

Synopsis

HELP:   Regular expression for validation and/or replacement
TYPE:   OBJECT
SYNTAX: REGEXP(PATTERN='str',REPLACE='str',NOCASE,MULTILINE,DOT4ALL,EXTENDED,NOCAPTURE,SUBALL,RPLONLY,FMTERR,IGNREC)

Description

This object can be used to activate the validation and/or replacement of the content of a string. For this a Perl-compatible regular expression and optional a corresponding replacement string can be defined.

Writing regular expressions may seem like a daunting task if you never did so before. You can find a tutorial that will get you started quickly here:

https://www.regular-expressions.info/quickstart.html

Countless other tutorials and documentation for regular expressions can be found on the web. We recommend to consult these resources to familiarize yourself with regular expressions.

Advanced users can find the complete syntax documentation for writing regular expression patterns by following this URL:

https://www.pcre.org/current/doc/html/pcre2pattern.html

At write you can ignore all records without a successful match of the regular expression. In this case the unmatching lines will be skipped. By default a mismatch will result in a validation error. If the replace string defined, then the default will keep the data if no match found. In this case the IGNREC switch will skip all lines where no replacement are done. With the FMTERR switch you can enforce an error if no replacement done but a replacement string provided.

Several flags are supported to control the behavior of the validation or substitution process.

Arguments