Function | Syntax | Description |
regexp_extract_all(x, regular expression) | Extracts the substrings that match a specified regular expression from a specified string and returns a collection of all matched substrings. | |
| regexp_extract_all(x, regular expression, n) | Extracts the substrings that match a specified regular expression from a specified string and returns a collection of substrings that match the target capture group. |
regexp_extract(x, regular expression) | Extracts and returns the first substring that matches a specified regular expression from a specified string. | |
| regexp_extract(x, regular expression, n) | Extracts the substrings that match a specified regular expression from a specified string and returns the first substring that matches the target capture group. |
regexp_like(x, regular expression) | Checks whether a specified string matches a specified regular expression. | |
regexp_replace(x, regular expression) | Deletes the substrings that match a specified regular expression from a specified string and returns the substrings that are not deleted. | |
| regexp_replace(x, regular expression, replace string) | Replaces the substrings that match a specified regular expression in a specified string and returns the new string after the replacement. |
regexp_split(x, regular expression) | Splits a specified string into multiple substrings by using a specified regular expression and returns a collection of the substrings. |
regexp_extract_all
function is used to extract the substrings that match a specified regular expression from a specified string.regexp_extract_all(x, regular expression)
regexp_extract_all(x, regular expression, n)
Parameter | Description |
x | The parameter value is of the varchar type. |
regular expression | The regular expression that contains capture groups. For example, (\\d)(\\d)(\\d) indicates three capture groups. |
n | The nth capture group. n is an integer that starts from 1. |
http_protocol
field.* | SELECT regexp_extract_all(http_protocol, '\\d+')
[1,1]
regexp_extract
function is used to extract the first substring that matches a specified regular expression from a specified string.regexp_extract(x, regular expression)
regexp_extract(x, regular expression, n)
Parameter | Description |
x | The parameter value is of the varchar type. |
regular expression | The regular expression that contains capture groups. For example, (\\d)(\\d)(\\d) indicates three capture groups. |
n | The nth capture group. n is an integer that starts from 1. |
http_protocol
field* | SELECT regexp_extract_all(http_protocol, '\\d+')
1
request_uri
field and count the number of times each file is accessed* | select regexp_like(server_protocol, '\\d+')
regexp_like
function is used to check whether a specified string matches a specified regular expression.regexp_like (x, regular expression)
Parameter | Description |
x | The parameter value is of the varchar type. |
regular expression | Regular expression. |
server_protocol
field contains digits.* | select regexp_like(server_protocol, '\\d+')
TRUE
regexp_replace
function is used to delete or replace the substrings that match a specified regular expression in a specified string.regexp_replace (x, regular expression)
regexp_replace (x, regular expression, replace string)
Parameter | Description |
x | The parameter value is of the varchar type. |
regular expression | Regular expression. |
replace string | Substring that is used to replace the matched substring. |
server_protocol
field and calculate the number of requests for each communication protocol.* | select regexp_replace(server_protocol, '.\\d+') AS server_protocol, count(*) AS count GROUP BY server_protocol
server_protocol | count |
HTTP | 357 |
regexp_split
function is used to split a specified string into multiple substrings and return a collection of the substrings.regexp_split (x, regular expression)
Parameter | Description |
x | The parameter value is of the varchar type. |
regular expression | Regular expression. |
server_protocol
field with forward slashes (/).* | select regexp_split(server_protocol, '/')
["HTTP","1.1"]
Apakah halaman ini membantu?