REGEXMATCH Function
REGEXMATCH returns TRUE if the text matches a regular expression pattern, otherwise FALSE.
Syntax
Parameters
| Parameter | Description | Required |
|---|---|---|
| text | The text to test against the regular expression. | Required |
| regular_expression | The RE2 regular expression pattern to match. Some metacharacters need escaping. | Required |
Basic Example
Check if an email address looks valid
=REGEXMATCH(A2, '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$')The pattern checks for a typical email format. It returns TRUE if A2 matches.
Advanced Examples
Example 1: Check for a phone number pattern
Data validationDetect if a cell contains a 10-digit US phone number
=REGEXMATCH(A2, '\d{3}-\d{3}-\d{4}')Example 2: Match whole column with ARRAYFORMULA
Bulk validationCheck every cell in a column for a valid code format
=ARRAYFORMULA(REGEXMATCH(A2:A100, '^CODE-[0-9]{4}$'))How REGEXMATCH Works
REGEXMATCH evaluates the text against a regular expression using the RE2 syntax. It returns TRUE if the text contains a match anywhere (unless anchored), and FALSE otherwise. The pattern is case-sensitive by default.
Important Notes & Limitations
REGEXMATCH is Google Sheets only. Excel uses ISNUMBER(SEARCH(...)) or VBA/User-Defined Functions for regex.
It uses RE2 syntax, which does not support all features of PCRE or .NET regex.
Lookahead and lookbehind assertions are not supported in RE2.
The pattern is case-sensitive; use character classes like [A-Za-z] for case-insensitive matching.
Common Errors & Fixes
#VALUE! errorThe regular expression is invalid or uses unsupported syntax.Fix: Test the pattern in a regex tester and ensure it uses RE2-compatible syntax.
Unexpected matchThe pattern matches part of the text because it is not anchored.Fix: Add ^ at the start and $ at the end to match the entire string.
Case-sensitive mismatchREGEXMATCH is case-sensitive.Fix: Use character classes like [A-Za-z] or convert the text with LOWER/UPPER first.
Download Practice File
REGEXMATCH
regexmatchPractice REGEXMATCH with Real Data
Download a sample CSV file with pre-populated data and practice exercises for the REGEXMATCH function. Works in both Excel and Google Sheets.
File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps