Quick Answer

REGEXMATCH Function

REGEXMATCH returns TRUE if the text matches a regular expression pattern, otherwise FALSE.

✓ Excel✓ Google SheetsExcel Google Sheets only

Syntax

REGEXMATCH
(text, regular_expression)

Parameters

ParameterDescriptionRequired
textThe text to test against the regular expression.Required
regular_expressionThe 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,}$')
ResultTRUE or FALSE

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 validation

Detect if a cell contains a 10-digit US phone number

=REGEXMATCH(A2, '\d{3}-\d{3}-\d{4}')
Result: TRUE if a phone number is found
The pattern looks for three digits, a hyphen, three digits, a hyphen, and four digits.

Example 2: Match whole column with ARRAYFORMULA

Bulk validation

Check every cell in a column for a valid code format

=ARRAYFORMULA(REGEXMATCH(A2:A100, '^CODE-[0-9]{4}$'))
Result: Column of TRUE/FALSE values
ARRAYFORMULA applies REGEXMATCH to each row.

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.

1
Write the text or reference
Select the cell containing the text to test.
2
Build the regex pattern
Create a regular expression that describes the pattern you want to match.
3
Enter the formula
Type =REGEXMATCH(text, 'pattern').
4
Use with IF or FILTER
Wrap with IF to return custom messages, or use FILTER to extract matching rows.

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

Practice 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.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

Can REGEXMATCH return the matched text?
No, it returns only TRUE or FALSE. Use REGEXEXTRACT to capture matched text.
Is REGEXMATCH case-sensitive?
Yes. Use [A-Za-z] or LOWER/UPPER to handle case.
Can I use REGEXMATCH in Excel?
Excel does not have a built-in REGEXMATCH function. You can use VBA or Office Scripts.
Does it support capture groups?
No, REGEXMATCH only checks for a match. Use REGEXEXTRACT for capture groups.