# REGEXMATCH in Google Sheets: syntax and examples

URL: https://goingstellar.ro/reference/sheets/regexmatch/

REGEXMATCH checks whether a text contains a match for a regular expression and returns TRUE or FALSE. It is case-sensitive and matches anywhere in the text unless you anchor the pattern. Use it inside IF, FILTER or COUNTIF-style formulas to test formats.

Try the pattern first in our [RE2 regex tester](https://goingstellar.ro/tools/re2-regex-tester/): it uses RE2 syntax, the same as Google Sheets, and runs in your browser.

## Syntax

```
REGEXMATCH(text, regular_expression)
```

## Arguments

- `text` (string, required: yes): The text to test. A cell holding a number is not accepted: convert it to text first.
- `regular_expression` (string, required: yes): The pattern, written as text. It is case-sensitive and not anchored.

## Examples

The examples use this table, starting in A1:

| Email | Code | Phone |
|---|---|---|
| ana@example.com | RO-1042 | 0722 123 456 |
| BOB@Example.org | ro-77 | +40 744 000 111 |
| no email here | RO-2001 | 021 555 000 |
| carl@sample | XX-9 | 0722123456 |

```
=REGEXMATCH(A2, "^[^@\s]+@[^@\s]+\.[a-z]+$")
```

Result: `TRUE`

A basic email shape check: text, an at sign, a domain, a dot, letters. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=REGEXMATCH(B3, "RO-\d+")
```

Result: `FALSE`

Lowercase "ro-77" does not match an uppercase pattern. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=REGEXMATCH(B3, "(?i)RO-\d+")
```

Result: `TRUE`

The (?i) flag makes the same test ignore case. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=ARRAYFORMULA(REGEXMATCH(B2:B5, "^RO-\d+$"))
```

Result: 

| TRUE |
|---|
| FALSE |
| TRUE |
| FALSE |

One TRUE or FALSE per code. Anchors make the whole cell match. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=SUM(ARRAYFORMULA(--REGEXMATCH(A2:A5, "@")))
```

Result: `3`

How many cells contain an at sign. The double minus turns TRUE into 1. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=REGEXMATCH(C2, "^(\+40|0)7\d{2} ?\d{3} ?\d{3}$")
```

Result: `TRUE`

A Romanian mobile number with optional spaces. Run in a Google Sheet (English US locale) on 2026-11-29.

## Common errors

- The match is case-sensitive. "ro-77" does not match "RO-\d+". Start the pattern with (?i) to ignore case.
- Without anchors the pattern can match anywhere. "\d+" is TRUE for "ABC123XYZ". Add a caret at the start and a dollar sign at the end to require a full match, and the same test returns FALSE.
- An invalid pattern, or one that uses lookahead such as a(?=b), returns #REF!, because the engine does not support lookaround.
- A real number as the first argument returns #VALUE!. Convert it with TO_TEXT first.

## Compared with Excel

Excel has no REGEXMATCH. Newer Excel 365 builds add REGEXTEST, whose pattern rules are not the same as the RE2 engine in Sheets.

## Questions and answers

### How do I test a whole column at once?

Wrap the call in ARRAYFORMULA: ARRAYFORMULA(REGEXMATCH(B2:B5, "(?i)^ro-")) returns one TRUE or FALSE per row.

## Related functions

- [REGEXEXTRACT](https://goingstellar.ro/reference/sheets/regexextract/)
- [REGEXREPLACE](https://goingstellar.ro/reference/sheets/regexreplace/)
- [FILTER](https://goingstellar.ro/reference/sheets/filter/)
- [TEXT](https://goingstellar.ro/reference/sheets/text/)
- [SPLIT](https://goingstellar.ro/reference/sheets/split/)
- [TEXTJOIN](https://goingstellar.ro/reference/sheets/textjoin/)

## Sources

- [REGEXMATCH (Docs Editors Help)](https://support.google.com/docs/answer/3098292)

