REGEXEXTRACT
Description
Returns a substring extracted from another string, based on the specified regular expression.
Syntax
REGEXEXTRACT(
text
,
regex
, [
ignore_case
])
- text: The text to search.
- regex: The regular expression.
- ignore_case: If TRUE, the function ignores case when searching. If FALSE, the function considers case. The default is FALSE.
Example
Formula | Result |
|---|---|
=REGEXEXTRACT(A1, "\D{3}\d+")
Where cell A1 contains
Find the DPT231 cost center value in a comment.
.
| DPT231 |
=REGEXEXTRACT(A1, "\(([A-Za-z]+)\)")
Where cell A1 contains
Check total (monthly)
.
| (monthly) |
=REGEXEXTRACT(A1,"[0-9]+")
Where cell A1 contains
6000:Salaries and Wages
.
| 6000 |
=REGEXEXTRACT(A1,"[0-9]*\.[0-9]+[0-9]+")
Where cell A1 contains
Total for 2017 is $2451.00
.
| 2451.00 |
Related Functions
REGEXFIND
REGEXPARSE