Premium Google Sheets drill · Text and regular expressions
REGEXEXTRACT an order id
Practice Google Sheets REGEXEXTRACT to pull the digits from an order note. The capture comes back as text.
A2 says Order 1842 ready. REGEXEXTRACT returns the first capture group as text, even when the characters are digits.
In B2, extract the digits from A2.
Dataset
Starter sheet. Cells marked formula are where the formula goes.
| Row | A | B |
|---|---|---|
| 1 | Note | |
| 2 | Order 1842 ready | Formula goes in B2. formula |
Hint
A capture group is parentheses around \\d+ inside the pattern string.
Explanation
The pattern (\d+) captures 1842. REGEXEXTRACT returns that group as text, so a leading zero in another id would stay a zero.
The interactive sheet and a worked solution are part of Formula Drills Premium. The instructions and starter data on this page are the full problem.