IfMatch options are used in any measure, of any type, to evaluate a Perl Compatible Regular Expression. The regular expression will be evaluated as "true" or "false" based on matching with the string value of the measure, and will execute IfMatchAction or IfNotMatchAction action options, which will contain one or more Bangs or commands.
There can be multiple sets of match and action options in the measure, by using IfMatch2 / IfMatchAction2 / IfNotMatchAction2 and so on.
The full range of PCRE regular expression functionality is supported, so the match can be made on all or part of the measure's string value, can test the order of sub-strings within the string, and can test for both the presence or absence of a sub-string within the string. Logical OR and AND testing can be done in the regular expression, using the
| character to support OR and Lookahead assertions
(?=..) to support AND.
Reserved characters in regular expression, which are
| must be escaped with the
\ character when used as a literal in the
IfMatch option. If using a measure value as a section variable in the IfMatch option, the :EscapeRegExp modifier can be used to properly escape reserved characters in the measure.
() should not be used in the regular expression, as nothing is being captured and no indexes are being created. The function is simply used to test if the string measure matches some regular expression pattern, and will either be "true" (IfMatchAction) or "false" (IfNotMatchAction).
The regular expression matched with the string value of the measure.
Examples: Measure value is "Red, Green, Blue"
IfMatch=Red, Green, Blue: true
Optional action to be executed when the regular expression in IfMatch results in "true". The action is executed only once when the condition becomes "true", so it needs to become "false" and again "true" to execute again.
Optional action to be executed when the regular expression in IfMatch results in "false". The action is executed only once when the condition becomes "false", so it needs to become "true" and again "false" to execute again.
If set to
1, the evaluation of the match will execute the appropriate actions in IfMatchAction or IfNotMatchAction on every update of the measure.
This option changes the behavior from "becomes true or false" to "is true or false".
Note: Care should be taken not to create an infinite loop in the actions. In particular,
!UpdateMeasure #CURRENTSECTION#should generally be avoided when