REGEXEXTRACT in Google Sheets
Returns the part of a text that matches a pattern (a regular expression).
Syntax
REGEXEXTRACT(text, regular_expression)- text
- The text to search. It must be text; a number gives #VALUE!.
- regular_expression
- The pattern in quotes, such as "\d+" for one or more digits.
Examples
C1
=REGEXEXTRACT(1A2,2"\d+")| A | B | C | |
|---|---|---|---|
| 1 | Note | 1001 | |
| 2 | Order 1001 shipped |
In plain words: Pull 2the first run of digits out of 1the note in A2.
C1=REGEXEXTRACT(A2,"@(.+)$")
| A | B | C | |
|---|---|---|---|
| 1 | example.com | ||
| 2 | ann@example.com |