Dylan He created FLINK-35963:
--------------------------------

             Summary: Add REGEXP_SUBSTR function
                 Key: FLINK-35963
                 URL: https://issues.apache.org/jira/browse/FLINK-35963
             Project: Flink
          Issue Type: Sub-task
          Components: Table SQL / API
            Reporter: Dylan He


Add REGEXP_SUBSTR function.
----
Returns the first substring in {{str}} that matches {{regex}}.

Example:
{code:sql}
> SELECT REGEXP_SUBSTR('Steven Jones and Stephen Smith are the best players', 
> 'Ste(v|ph)en');
 Steven
> SELECT REGEXP_SUBSTR('Mary had a little lamb', 'Ste(v|ph)en');
 NULL
{code}

Syntax:
{code:sql}
REGEXP_SUBSTR(str, regex)
{code}

Arguments:
 * {{str}}: A STRING expression to be matched.
 * {{regex}}: A STRING expression with a pattern.

Returns:
A STRING.

In case of a malformed {{regex}} the function returns an error. 
If either argument is NULL or the pattern is not found, 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_substr.html]
 * 
[MySQL|https://dev.mysql.com/doc/refman/8.4/en/regexp.html#function_regexp-substr]
 * 
[PostgreSQL|https://www.postgresql.org/docs/16/functions-matching.html#FUNCTIONS-POSIX-REGEXP]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to