pattern-test
Syntax
- pattern-test: regular expression
Description
The pattern-test operation tests for the existence of a pattern with text. If the pattern exists one or more times, the result of pattern-test is true, otherwise it is false.
The argument to pattern-test can be a simple string, such as a word or a number. The value can also be a full regular
expression, allowing for more complicated matches to take place. Regular expressions should always be surrounded in a
pair of forward slashes — for example, /WARMUP/. Regex flags can be appended after the closing slash:
/pattern/flags. Supported flags are i (case-insensitive), m (multiline), s (single-line), and u (unicode). If
a regular expression is syntactically invalid, the adapter will report a configuration error at startup. The argument
can also be a string expression using ${} syntax to embed dynamic values. The
slashes won’t be considered part of the pattern itself.
Pattern matching is an advanced technical topic. You should have familiarity with common regular expression syntax and rules if you plan to replace patterns more complex than an exact string match.
Examples
- AdapterScript
- Result
var1:
- source: program-name
- pattern-test: WARMUP
In the above example, program-name is an identifier from another part of the adapter script.
INPUT: WARMUP1 RESULT: true
INPUT: O7003 RESULT: false
- AdapterScript
- Result
var1:
- source: program-name
- pattern-test: /O[0-9]+/
In the above example, program-name is an identifier from another part of the adapter script.
INPUT: O7003 RESULT: true
INPUT: 9001 RESULT: false