Category: String functions
Checks whether a text value matches a given regular expression. Returns true if the pattern matches, otherwise false.
Syntax
match-pattern(a, b)Parameters
Parameter | Type | Description |
|---|---|---|
| Text | The text value to check. |
| Text | A Java-compatible regular expression to match |
Return value
true if the regular expression b fully matches the text a, otherwise false.
Examples
Text ( | Pattern ( | Result | Explanation |
|---|---|---|---|
|
|
| The text consists only of word characters (letters, digits, underscore). |
|
|
| The text does not consist only of digits. |
|
|
| The text contains only characters in the ASCII range A to z (includes uppercase and lowercase letters). |
|
|
| The text also contains lowercase letters. A pattern for uppercase letters only, therefore does not match. |
|
|
| Matches the prefix |
|
|
| Matches a date in the format YYYY-MM-DD. |
(empty) |
|
| An empty string matches the pattern for empty. |
Use cases
Data validation: Make sure incoming field values match an expected format before further processing (for example, a date, email, or item number).
Conditional mapping: Use
match-pattern()inside a condition to control whether a mapping rule applies. For example, map a field only when its value starts with a certain prefix.Filtering: Skip or forward records based on whether a field value matches a defined pattern.
Tips
The regular expression follows Java regex syntax (see
java.util.regex.Pattern).The pattern is matched against the entire text. Use
.*at the start or end to allow a partial match (for example,.*keyword.*).Tools such as regex101.com are useful for testing expressions (select the Java flavor).
Starting with Release 26.2: The validity of a regular expression is automatically checked when you use Pathfinder for evaluation. You receive feedback from Pathfinder indicating whether the expression is correct or contains mistakes.
Related functions
Function | Description |
|---|---|
| Removes characters from a text until the remaining string matches a regular expression. |