REGEXMATCH Function in Excel, Google Sheets, Airtable & Notion
REGEXMATCH returns TRUE when text matches a regular expression pattern anywhere in the string, and FALSE otherwise. REGEXMATCH("Order A-1042", "[A-Z]-\d{4}") is TRUE.
Syntax in each app
| App | Support | Syntax & notes |
|---|---|---|
| Excel | ✔ Built in | REGEXTEST(text, pattern, [case_sensitivity])Microsoft 365 (2024) Excel's version is called REGEXTEST. Set case_sensitivity to 1 to ignore case. Uses PCRE2, so lookaheads work. Older Excel has no regular expressions; use SEARCH with wildcards for simple patterns. |
| Google Sheets | ✔ Built in | REGEXMATCH(text, regular_expression)Uses Google's RE2 syntax: no lookaheads or backreferences. Add (?i) at the start to ignore case. |
| Airtable | ✔ Built in | REGEX_MATCH(string, regex)Also RE2, like Google Sheets, and case-sensitive unless the pattern starts with (?i). Airtable shows the result as 1 or 0. |
| Notion | ✔ Built in | test(text, pattern)Returns true or false. There are no flags, so for a case-insensitive test, lowercase the text and write the pattern in lowercase: test(lower(prop("Name")), "inv-\\d+"). |
| Excel | =REGEXTEST("Order A-1042 shipped", "[A-Z]-\d{4}") | open excel.new ↗ |
|---|---|---|
| Google Sheets | =REGEXMATCH("Order A-1042 shipped", "[A-Z]-\d{4}") | open sheets.new ↗ |
| Airtable | REGEX_MATCH("Order A-1042 shipped", "[A-Z]-\\d{4}") | |
| Notion | test("Order A-1042 shipped", "[A-Z]-\\d{4}") |
Excel & Sheets use cell ranges. Paste this sample data into cell A1 of a blank sheet, then paste the formula into any empty cell.
The tester uses your browser's JavaScript regex engine, which agrees with RE2 for everyday patterns. Lookarounds and backreferences are reported as errors, as Google Sheets does; RE2-only syntax such as (?P<name>…) or [[:alpha:]] may not work here. Google Sheets returns #REF! for an invalid pattern; Excel returns #VALUE!.
Arguments
| Argument | What it means |
|---|---|
text | The text to test. |
regular_expression | The pattern. It matches anywhere in the text unless you anchor it with ^ (start) and $ (end). |
Examples
| Formula | Result | Why | Copy |
|---|---|---|---|
=REGEXMATCH("Order A-1042 shipped", "[A-Z]-\d{4}") | TRUE | Letter, dash, four digits anywhere in the text. | |
=REGEXMATCH("90210", "^\d{5}$") | TRUE | Anchors make the whole value match: a 5-digit ZIP code. | |
=REGEXMATCH("Invoice", "(?i)^inv") | TRUE | (?i) ignores case. | |
=REGEXMATCH("ada@example", "^[^@\s]+@[^@\s]+\.[a-z]{2,}$") | FALSE | A basic email check: no dot in the domain. |
Examples use Excel / Google Sheets syntax unless noted.
How REGEXMATCH works
A regular expression describes a pattern rather than fixed text, so one formula can check “a letter followed by a dash and four digits”, “a 5-digit ZIP code” or “looks like an email address”. REGEXMATCH returns TRUE or FALSE, which makes it a good fit for data validation, conditional formatting and FILTER conditions: =FILTER(A2:A100, REGEXMATCH(A2:A100, "^INV-")). Its sister functions REGEXEXTRACT and REGEXREPLACE (Airtable: REGEX_EXTRACT and REGEX_REPLACE) pull out or rewrite the matched part.
The pattern matches anywhere in the text unless you anchor it: "\d{5}" is TRUE for “Order 123456”, while "^\d{5}$" requires exactly five digits. Matching is case-sensitive; start the pattern with (?i) in Google Sheets, Airtable and Excel to ignore case. Google Sheets and Airtable use the RE2 engine, which has no lookaheads ((?=…)) or backreferences (\1). Excel's REGEXTEST uses PCRE2 and supports both. REGEXMATCH only works on text, so convert numbers first with TO_TEXT(A2) or A2&"".
In Excel the function is called REGEXTEST and only exists in Microsoft 365. Airtable's REGEX_MATCH works like Google Sheets. Notion's test(text, pattern) does the same, but has no inline flags, so lowercase the text for a case-insensitive test. In Airtable and Notion string literals, a regex backslash is written twice, as in "\\d".
Frequently Asked Questions
- How do I make REGEXMATCH ignore case?
- Put
(?i)at the start of the pattern:=REGEXMATCH(A2, "(?i)urgent"). In Excel useREGEXTEST(A2, "urgent", 1); in Notion usetest(lower(prop("Notes")), "urgent"). - Why does REGEXMATCH return an error on a number?
- It only accepts text. Convert the value first:
=REGEXMATCH(A2&"", "^\d+$")orTO_TEXT(A2).