# REGEXMATCH function in Google Sheets

> REGEXMATCH checks whether text contains a match for a regular expression and returns TRUE or FALSE.

Source: https://spreadsheetpractice.com/google-sheets/functions/regexmatch · Updated October 28, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

## Quick answer

- **What it does:** REGEXMATCH checks whether text contains a match for a regular expression and returns TRUE or FALSE.
- **Syntax:** `=REGEXMATCH(text, regular_expression)`
- **Most common use:** `=REGEXMATCH(B2,"refund|return")` returns TRUE (Either word matches: | means or)
- **Works in:** Google Sheets only
- **Returns:** TRUE if the pattern matches part of the text, FALSE if it doesn't.

## What it does

REGEXMATCH checks whether text contains a match for a regular expression and returns TRUE or FALSE. Use it to test a format, such as a valid order code, or to look for any of several words at once with a pattern like refund|return.

## Syntax

`=REGEXMATCH(text, regular_expression)`

| Argument | Required? | What it is |
|---|---|---|
| `text` | Required | The text to test. It has to be text: wrap numbers in TO_TEXT. |
| `regular_expression` | Required | The pattern to look for, in RE2 syntax. It can match anywhere in the text unless you anchor it with ^ and $. |

## Examples

Each result was calculated by running the formula on the sample sheet in Google Sheets mode.

| Cell | Formula | Result | What it shows |
|---|---|---|---|
| C2 | `=REGEXMATCH(B2,"refund\|return")` | TRUE | Either word matches: \| means or |
| C3 | `=REGEXMATCH(A3,"^TK-\d{4}$")` | FALSE | Checks the whole code is TK- plus exactly four digits; TK-20415 has five |
| C4 | `=REGEXMATCH(B4,"(?i)urgent")` | TRUE | (?i) ignores capitals, so URGENT matches |

### The sample sheet

Every formula above runs on this data:

|  | A | B | C |
|---|---|---|---|
| 1 | Ticket | Message | Result |
| 2 | TK-2041 | Customer wants a refund | TRUE |
| 3 | TK-20415 | Return label request | FALSE |
| 4 | TK-2093 | URGENT: card declined | TRUE |

## Common mistakes

| What you see | Why, and how to fix it |
|---|---|
| #VALUE! on a number | REGEXMATCH only accepts text, so a number such as 90210 gives an error. Convert it first: =REGEXMATCH(TO_TEXT(A2),"^9"). |
| It matches more than you meant | Without anchors the pattern can match anywhere, so "TK-\d{4}" also matches TK-20415. Add ^ and $ to test the whole text. |
| Capital letters don't match | Matching is case-sensitive. Start the pattern with (?i) to ignore case: "(?i)urgent". |
| A pattern copied from another tool gives an error | Sheets uses RE2, which has no lookaheads or backreferences such as (?=...) or \1. Rewrite the pattern, or split the test into two REGEXMATCH calls joined with AND. |

## Tips

- Filter rows by pattern: =FILTER(A2:B9,REGEXMATCH(B2:B9,"refund|return")).
- Escape special characters with a backslash: "\." matches a real dot and "\$" a dollar sign.

## REGEXMATCH in Excel

Recent Microsoft 365 builds have REGEXTEST for the same job. Other Excel versions have no regular expressions, so a simple "contains" test uses ISNUMBER with SEARCH.

## Questions

### How do I check if a cell contains one of several words in Google Sheets?

Separate the words with |: =REGEXMATCH(A2,"refund|return|cancel"). Add (?i) at the start to ignore capitals.

### How do I use REGEXMATCH on a whole column?

Wrap it in ARRAYFORMULA, =ARRAYFORMULA(REGEXMATCH(B2:B9,"refund")), or use it as a FILTER condition, which takes ranges directly.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
