# REGEXEXTRACT in Google Sheets: syntax and examples

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

REGEXEXTRACT returns the first piece of text that matches a regular expression. Use a capture group in parentheses to return only part of the match, such as the domain of an email address.

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

```
REGEXEXTRACT(text, regular_expression)
```

## Arguments

- `text` (string, required: yes): The text to search.
- `regular_expression` (string, required: yes): A RE2 pattern. With one capture group, only the group is returned. With several, they fill neighbouring cells.

## Examples

The examples use this table, starting in A1:

| Text |
|---|
| Order #A-1042 shipped |
| ana.pop@example.com |
| Price: 129.50 RON |

```
=REGEXEXTRACT(A3, "@(.+)$")
```

Result: `example.com`

Domain of an email. The parentheses mark the part to return, so the @ is left out. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=REGEXEXTRACT(A2, "[A-Z]-\d+")
```

Result: `A-1042`

First match of a letter, a dash and digits: the order code. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=REGEXEXTRACT(A4, "\d+\.\d+")
```

Result: `129.50`

A decimal number inside text. The result is text, not a number. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=VALUE(REGEXEXTRACT(A4, "\d+"))
```

Result: `129`

VALUE turns the extracted digits into a real number you can add up. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=REGEXEXTRACT(A3, "(.+)@(.+)")
```

Result: 

| ana.pop | example.com |
|---|---|


Two capture groups spill into two cells: user name, then domain. Run in a Google Sheet (English US locale) on 2026-11-29.

## Common errors

- When nothing matches, REGEXEXTRACT returns #N/A. Wrap it in IFERROR to get an empty cell or a default.
- A pattern that is not valid, for example an unclosed parenthesis, returns #REF!.
- The result is text, even for digits. Wrap it in VALUE before adding or comparing numbers.
- Only the first match is returned. Later matches are ignored.

## Compared with Excel

Classic Excel has no REGEXEXTRACT. Excel 365 added one with extra arguments, and its regex flavor differs from the RE2 used in Sheets.

## Questions and answers

### Is the match case sensitive?

Yes. Add (?i) at the start of the pattern for a case-insensitive match.

## Related functions

- [REGEXMATCH](https://goingstellar.ro/reference/sheets/regexmatch/)
- [REGEXREPLACE](https://goingstellar.ro/reference/sheets/regexreplace/)
- [SPLIT](https://goingstellar.ro/reference/sheets/split/)
- [VALUE](https://goingstellar.ro/reference/sheets/value/)
- [IFERROR](https://goingstellar.ro/reference/sheets/iferror/)
- [MID](https://goingstellar.ro/reference/sheets/mid/)

## Sources

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

