Dylan He created FLINK-35931:
--------------------------------
Summary: Add REGEXP_EXTRACT_ALL function
Key: FLINK-35931
URL: https://issues.apache.org/jira/browse/FLINK-35931
Project: Flink
Issue Type: Sub-task
Components: Table SQL / API
Reporter: Dylan He
Add REGEXP_EXTRACT_ALL function.
----
Extracts all of the strings in {{str}} that match the {{regexp}} expression and
correspond to the regex group {{idx}}.
Example:
{code:sql}
> SELECT REGEXP_EXTRACT_ALL('100-200, 300-400', '(\\d+)-(\\d+)', 1);
[100, 300]
> SELECT REGEXP_EXTRACT_ALL('100-200, 300-400', r'(\d+)-(\d+)', 1);
["100","300"]
{code}
Syntax:
{code:sql}
REGEXP_EXTRACT_ALL(str, regexp[, idx])
{code}
Arguments:
* {{str}}: A STRING expression to be matched.
* {{regexp}}: A STRING expression with a matching pattern.
* {{idx}}: An optional INTEGER expression greater or equal 0 with default 1.
Returns:
An ARRAY<STRING>.
{{regexp}} must be a Java regular expression.
When using literals, use `raw-literal` (`r` prefix) to avoid escape character
pre-processing.
{{regexp}} may contain multiple groups. {{idx}} indicates which regex group to
extract. An {{idx}} of 0 means matching the entire regular expression.
See also:
*
[Spark|https://spark.apache.org/docs/3.5.1/sql-ref-functions-builtin.html#string-functions]
*
[Databricks|https://docs.databricks.com/en/sql/language-manual/functions/regexp_extract_all.html]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)