Dylan He created FLINK-35932: -------------------------------- Summary: 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
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] -- This message was sent by Atlassian Jira (v8.20.10#820010)