They do what you’d expect them to: They group the contained expressions into a single unit. Groups are used for simplifying regex notation, applying quantifiers to sub-expressions, and they are also useful in search and replace operations.
In the above example a group was used to make the pattern more concise.
The regular expression evaluation window allows to match regular expressions against up to three different input strings.
The input field for the test strings turns green if the regex matches the input field’s current value. The “Capture” section of the evaluation window is useful for testing data extraction from the input string.
But grouping the alternatives into a separate expression has another advantage.
Groups are sometimes referred to as “capture groups” because in case of a match, each group’s matched sub-string is captured, and is available for extraction.
The most basic building block in a regular expression is a character a.k.a. Most characters in a regex pattern do not have a special meaning, they simply match themselves.
Consider the following pattern: None of the characters in this pattern carries special meaning. Therefore there is only one string that matches this pattern, and it is identical to the pattern string itself: “I am a harmless regex pattern”.
The download package contains many samples of how to use regular expressions within PDI.
Let’s start with a basic question that may present itself if you’ve never worked with regular expressions before.