Dylan He created FLINK-35962:
--------------------------------

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


Add REGEXP_INSTR function.
----
Returns the position of the first substring in {{str}} that matches {{regex}}.

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

Syntax:
{code:sql}
REGEXP_INSTR(str, regex)
{code}
Arguments:
 * {{str}}: A STRING expression to be matched.
 * {{regex}}: A STRING expression with a pattern.

Returns:
A STRING.

Result indexes begin at 1, 0 if there is no match.
In case of a malformed {{regex}} the function returns an error. 
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_instr.html]
 * 
[MySQL|https://dev.mysql.com/doc/refman/8.4/en/regexp.html#function_regexp-instr]
 * 
[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