REGEXMATCH Function in Google Sheets
Returns TRUE if a string matches a regex pattern, FALSE otherwise. The boolean version of REGEXEXTRACT — useful in conditionals and FILTER.
Syntax
REGEXMATCH(text, regular_expression)Returns: TRUE if the pattern matches anywhere in text, otherwise FALSE.
Excel equivalent: No direct equivalent.
Parameters
| Name | Required | Description |
|---|---|---|
| text | Required | The string to test. |
| regular_expression | Required | A regex pattern in RE2 syntax. |
Examples
Validate email format
=REGEXMATCH(A2, "^[^@]+@[^@]+\.[^@]+$")Returns TRUE for strings that look like emails. Not RFC-strict but catches the common case.
Filter rows containing a keyword
=FILTER(A:C, REGEXMATCH(B:B, "urgent|priority|asap"))Returns rows where column B contains any of those words.
Conditional based on pattern
=IF(REGEXMATCH(A2, "\\d{4}"), "Has year", "No year")Checks if A2 contains a 4-digit number.
When to use an alternative
- SEARCH / FIND — You only need to find a literal substring, no pattern needed.
- ISNUMBER + MATCH — You're checking membership in a list, not a pattern.
- REGEXEXTRACT wrapped in ISNUMBER — Edge case where the boolean result behaves better.
Common errors and how to fix them
Returns FALSE for matches you expect
Cause: RE2 syntax restriction or escaping issue.
Fix: Test on regex101.com with RE2 flavor selected. Watch for backslash escaping in Sheets formulas — \\d means \d in the regex.
Related functions
Frequently Asked Questions
When should I use REGEXMATCH vs SEARCH?
SEARCH for literal substrings, REGEXMATCH for patterns. SEARCH("@", A2) checks if there's an @ symbol. REGEXMATCH(A2, "\d{4}") checks if there are exactly 4 digits. Use the simplest tool that fits.
Why do I need double backslashes?
Backslash is an escape character in formula strings too. To get \d (digit) in the regex, write \\d in the formula string. To match a literal backslash in text, write \\\\ in the formula.