Skip to main content

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 (/). 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

  var1:
- source: program-name
- pattern-test: WARMUP
info

In the above example, program-name is an identifier from another part of the adapter script.

  var1:
- source: program-name
- pattern-test: /O[0-9]+/
info

In the above example, program-name is an identifier from another part of the adapter script.