--- title: "match-pattern()" slug: "string-match-pattern" updated: 2026-08-17T07:52:33Z published: 2026-08-17T07:52:33Z canonical: "docs.lobstersoftware.com/string-match-pattern" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # match-pattern() **Category:** String functions Checks whether a text value matches a given regular expression. Returns `true` if the pattern matches, otherwise `false`. ## Syntax ```plaintext match-pattern(a, b) ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | `a` | Text | The text value to check. | | `b` | Text | A Java-compatible regular expression to match `a` against. | ## Return value `true` if the regular expression `b` fully matches the text `a`, otherwise `false`. ## Examples | Text (`a`) | Pattern (`b`) | Result | Explanation | | --- | --- | --- | --- | | `ABCabc` | `^\w+$` | `true` | The text consists only of word characters (letters, digits, underscore). | | `ABCabc` | `^\d+$` | `false` | The text does not consist only of digits. | | `ABCabc` | `^[A-z]+$` | `true` | The text contains only characters in the ASCII range A to z (includes uppercase and lowercase letters). | | `ABCabc` | `^[A-Z]+$` | `false` | The text also contains lowercase letters. A pattern for uppercase letters only, therefore does not match. | | `order-12345` | `^order-\d+$` | `true` | Matches the prefix `order-` followed by one or more digits. | | `2025-06-10` | `^\d{4}-\d{2}-\d{2}$` | `true` | Matches a date in the format YYYY-MM-DD. | | (empty) | `^$` | `true` | 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, e-mail, 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 (see [Creating regular expressions with Pathfinder](/v1/docs/en/pathfinder-regex)) for evaluation. You receive feedback from Pathfinder indicating whether the expression is correct or contains mistakes. ## Related functions | Function | Description | | --- | --- | | `cut-until-match(a, b, c)` | Removes characters from a text until the remaining string matches a regular expression. | Lobster Data Platform's AI helper that answers questions based on product documentation and can generate content such as cron expressions, SQL queries, and regular expressions (regex). The range of functions is continuously expanded.