get_regex¶
Description¶
Returns a string that matches the given regular expression (which may be null if nothing matches.) There are two optional parameters: a capture group parameter to specify which group to capture and a string parameter to specify flags:
c - Enables case-sensitive matching (default.)
i - Enables case-insensitive matching.
m - Enables multi-line mode (i.e. meta-characters ^ and $ match the beginning and end of any line of the input string.) By default, multi-line mode is disabled (i.e. ^ and $ match the beginning and end of the entire input string.)
s - Enables the POSIX wildcard character
.
to match\n
(newline.) By default,.
does not match\n
.
For more about regular expression syntax, see POSIX extended regular expressions.
This function returns null
for the empty regular expression ""
for all inputs. However, it returns the empty string ""
for the
the empty group regular expression "()"
for all valid inputs except null
.
It returns null
in case of null or invalid arguments, or any other error.
Return type¶
string
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
get_regex( input_string, pattern [ , group ] [ , flags ] )
Argument |
Type |
Required |
Multiple |
Constant |
---|---|---|---|---|
input_string |
variant |
Required |
Only one |
Variable |
pattern |
regex |
Required |
Only one |
Constant |
group |
int64 |
Optional |
Only one |
Constant |
flags |
string |
Optional |
Only one |
Constant |
Examples¶
filter get_regex(log, /er*or/) = 'error'
Filter rows from the input column log
where the regex capture matches ‘error’.