Apache Pinot Docs
Search…
latest
regexpExtract
This section contains reference documentation for the regexpExtract function.
Extracts values that match the provided regular expression

Signature

regexpExtract(value, regexp)
regexpExtract(value, regexp, group)
regexpExtract(value, regexp, group, defaultValue)

Usage Examples

1
select regexpExtract('foo', '.*') AS value
2
from ignoreMe
Copied!
value
foo
1
select regexpExtract('foo123', '[0-9]+') AS value
2
from ignoreMe
Copied!
value
123
1
select regexpExtract('foo123', '[^0-9]+') AS value
2
from ignoreMe
Copied!
value
foo
1
select regexpExtract('foo bar baz', '(\w+) (\w+)', 0) AS value
2
from ignoreMe
Copied!
value
foo bar
1
select regexpExtract('foo bar baz', '(\w+) (\w+)', 2) AS value
2
from ignoreMe
Copied!
value
bar
1
select regexpExtract('foo123', 'bar', 0, 'defaultValue') AS value
2
from ignoreMe
Copied!
value
defaultValue
Last modified 3mo ago
Copy link