Skip to content

Regex selection¤

Description of the plugin¤

This transformer takes three inputs: a single output value, a sequence of regular expressions and a sequence of values to check against the regular expressions. It returns a sequence of copies of the output value exclusively at those positions where one of the regular expressions matches the input value.

In other words: It selects the matches within the sequence of values against the regular expressions and ‘marks’ them with the provided output value.

As a further detail of its operation: If the parameter oneOnly of the transformer is set to true, then only the position of the first matching regular expression will be marked with the output value. There won’t be any further marked matches.

Notes on regular expressions¤

The most commonly used examples of regular expressions are "\\s*" for representing whitespace characters, [^0-9]* for numbers, and [a-z]* for the usual English characters between a and z. The star (*) represents an arbitrary number of occurrences (zero included), whereas the plus sign (+) indicates a strictly positive number of occurrences (zero excluded).

An uppercase version of the predefined character classes means negation, such as "\\S*" for non-whitespace characters, or "\\D*" for non-digits. Similarly, the hat sign ^ can be used for negating (arbitrary) character classes, such as [^xyz] for any character except x, y or z.

Attention: Slashes in regular expressions have to be escaped, e.g. instead of \s we need to escape it as \\s.

Note for advanced users¤

A compilation of the available constructs for building regular expressions is available in the API of the Java Pattern.

Examples¤

Notation: List of values are represented via square brackets. Example: [first, second] represents a list of two values “first” and “second”.


sets the correct outputs based on the regexes:

  • Parameters

    • oneOnly: false
  • Input values:

    1. [output]
    2. [a, b, c]
    3. [catch]
  • Returns: [output, , output]


return only first match position if oneOnly = true:

  • Parameters

    • oneOnly: true
  • Input values:

    1. [output]
    2. [a, b, c]
    3. [catch]
  • Returns: [output, , ]

Parameter¤

One only¤

No description

  • ID: oneOnly
  • Datatype: boolean
  • Default Value: false

Advanced Parameter¤

None

  • regexExtract — The Regex selection plugin returns the provided output value in a result sequence aligned with the regex list, filling only the positions whose pattern matches the checked value. The Regex extract plugin returns the matched substring itself, or the first capturing group, so the output is taken from the input text rather than from the provided output value.
  • ifMatchesRegex — The If matches regex plugin returns one of the provided branch inputs based on whether the checked value matches. The Regex selection plugin returns a result sequence aligned with the pattern list, placing the provided output value at every matching position.
  • regexReplace — The Regex replace plugin returns a rewritten string by replacing every match inside the input text with the configured replacement. The Regex selection plugin returns a result sequence aligned with the pattern list and fills each matching position with the provided output value.
  • filterByRegex — The Regex selection plugin keeps the checked value out of the output and instead returns a pattern-list-shaped result filled with the provided output value where a pattern matches. The Filter by regex plugin keeps or drops values from the input sequence based on full-string matching.

Comments