Google Sheets REGEXEXTRACT function
Pulls out the first part of a text that matches a pattern. It is a Sheets-only function. It has the same name in Spanish Sheets.
Syntax
English Sheets
=REGEXEXTRACT(text, regular_expression)
Spanish Sheets (Mexico locale)
=REGEXEXTRACT(texto, expresión_regular)
Spanish Sheets (Spain, Latin America)
=REGEXEXTRACT(texto; expresión_regular)
| Argument | What it is |
|---|---|
| text | The text to pull the part from. |
| regular_expression | The pattern, like "[0-9]+". |
Example
REGEXEXTRACT(text, regular_expression) pulls out the part of the text that matches a pattern: [0-9]+ is one or more digits. If the pattern has a group in parentheses, it returns just that group. It is a Sheets-only function.
=REGEXEXTRACT(A2,"[0-9]+")
Common mistake
With no match it returns #N/A. The result is text even if it is digits: use VALUE if you need the number.
About Ads
This site uses Google AdSense to display ads. These ads help us keep WebHerramientas completely free. Ads are managed by Google and meet strict security and privacy standards.
Ads help us keep WebHerramientas free for everyone
Practice REGEXEXTRACT
Type the formula in the sheet and check it instantly. Spanish or English function names both work. See all lessons
REGEXEXTRACT
REGEXEXTRACT(text, regular_expression) pulls out the part of the text that matches a pattern: [0-9]+ is one or more digits. If the pattern has a group in parentheses, it returns just that group. It is a Sheets-only function.
In B2, extract the order number inside each comment.
| A | B | C | |
|---|---|---|---|
| 1 | Comment | Order | |
| 2 | Order 4471 arrived late | ||
| 3 | Order 3902 incomplete | ||
| 4 | I want to exchange 5120 | ||
| 5 | Invoice for order 2718, please | ||
| 6 | Number 6634 arrived broken | ||
| 7 |
Tip: while typing, click a cell or drag across several to insert their reference.
Frequently asked questions
- What is REGEXEXTRACT called in Spanish?
- It has the same name: REGEXEXTRACT. Functions that started in Google Sheets keep their English name even in a Spanish spreadsheet. What changes is the separator: Spain and much of Latin America separate arguments with semicolons.
- Why does REGEXEXTRACT use semicolons in some spreadsheets?
- It depends on each spreadsheet's locale, under File > Settings. Where the comma is the decimal mark (Spain, much of South America), arguments are separated by semicolons. Mexico and United States locales use commas.
- What is the most common REGEXEXTRACT mistake?
- With no match it returns #N/A. The result is text even if it is digits: use VALUE if you need the number.