Text
REGEXEXTRACT
Extracts a match: mode 0 is the first, 1 all (array), 2 capture groups.
Syntax
REGEXEXTRACT(text, pattern, [return_mode], [case_sensitivity])Example: =REGEXEXTRACT(A2,"\d+")
Available in: Microsoft 365 only
Try it
A tiny spreadsheet with example data. Edit the formula or any number and see the result.
Formula in D2: =REGEXEXTRACT(A7,"\d+")
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Text | Other | Result | |
| 2 | Alice Johnson | alice johnson | 417 | |
| 3 | [email protected] | [email protected] | ||
| 4 | extra spaces | |||
| 5 | SKU-2026-0415 | |||
| 6 | iced coffee, tea, sugar | |||
| 7 | Order 417 shipped |
Result in D2: 417