Google Sheets function
REGEXMATCH function in Google Sheets
REGEXMATCH in Google Sheets checks whether text contains a part that matches a RE2 regular expression and returns TRUE or FALSE. Use it to validate structured identifiers, detect text patterns, or create conditions that are more flexible than exact comparisons.
Source: Google Docs Editors HelpLast verified Nov 5, 2026
Syntax
=REGEXMATCH(text, regular_expression)Arguments
| Argument | Required | What it means |
|---|---|---|
text | Yes | The text to test against the regular expression. |
regular_expression | Yes | The RE2 pattern used to test the text. |
Examples
Validate an order code
| A | |
|---|---|
| 1 | Order code |
| 2 | INV-204 |
=REGEXMATCH(A2,"^[A-Z]{3}-[0-9]{3}$")Result: true
The value has three capital letters, a hyphen, and three digits, so REGEXMATCH returns TRUE.
Common mistakes
Leaving the regular expression outside quotation marks.
Write a literal pattern as a text string.
Using unsupported Unicode character classes in the pattern.
Use syntax supported by the RE2 regular expression engine.