[
https://issues.apache.org/jira/browse/FLINK-35932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dylan He updated FLINK-35932:
-----------------------------
Description:
Add REGEXP_COUNT function.
----
Returns the number of times {{str}} matches the {{regex}} pattern.
Example:
{code:sql}
> SELECT REGEXP_COUNT('Steven Jones and Stephen Smith are the best players',
> 'Ste(v|ph)en');
2
> SELECT REGEXP_COUNT('Mary had a little lamb', 'Ste(v|ph)en');
0
{code}
Syntax:
{code:sql}
REGEXP_COUNT(str, regex)
{code}
Arguments:
* {{str}}: A STRING expression to be matched.
* {{regex}}: A STRING expression with a matching pattern.
Returns:
An INTEGER.
{{regex}} must be a Java regular expression.
If either argument is {{NULL}}, the result is {{NULL}}.
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_count.html]
* [PostgreSQL|https://www.postgresql.org/docs/16/functions-string.html]
was:
Add REGEXP_COUNT function.
----
Returns the number of times {{str}} matches the {{regexp}} pattern.
Example:
{code:sql}
> SELECT REGEXP_COUNT('Steven Jones and Stephen Smith are the best players',
> 'Ste(v|ph)en');
2
> SELECT REGEXP_COUNT('Mary had a little lamb', 'Ste(v|ph)en');
0
{code}
Syntax:
{code:sql}
REGEXP_COUNT(str, regexp)
{code}
Arguments:
* {{str}}: A STRING expression to be matched.
* {{regexp}}: A STRING expression with a matching pattern.
Returns:
An INTEGER.
{{regexp}} must be a Java regular expression.
When using literals, use `raw-literal` (`r` prefix) to avoid escape character
pre-processing.
If either argument is {{NULL}}, the result is {{NULL}}.
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_count.html]
* [PostgreSQL|https://www.postgresql.org/docs/16/functions-string.html]
> Add REGEXP_COUNT function
> -------------------------
>
> Key: FLINK-35932
> URL: https://issues.apache.org/jira/browse/FLINK-35932
> Project: Flink
> Issue Type: Sub-task
> Components: Table SQL / API
> Reporter: Dylan He
> Assignee: Dylan He
> Priority: Major
>
> Add REGEXP_COUNT function.
> ----
> Returns the number of times {{str}} matches the {{regex}} pattern.
> Example:
> {code:sql}
> > SELECT REGEXP_COUNT('Steven Jones and Stephen Smith are the best players',
> > 'Ste(v|ph)en');
> 2
> > SELECT REGEXP_COUNT('Mary had a little lamb', 'Ste(v|ph)en');
> 0
> {code}
> Syntax:
> {code:sql}
> REGEXP_COUNT(str, regex)
> {code}
> Arguments:
> * {{str}}: A STRING expression to be matched.
> * {{regex}}: A STRING expression with a matching pattern.
> Returns:
> An INTEGER.
> {{regex}} must be a Java regular expression.
> If either argument is {{NULL}}, the result is {{NULL}}.
> 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_count.html]
> * [PostgreSQL|https://www.postgresql.org/docs/16/functions-string.html]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)