All Products
Search
Document Center

Realtime Compute for Apache Flink:REGEXP

Last Updated:Aug 15, 2023

This topic describes how to use the REGEXP function. This function searches a specified string by using a regular expression and returns a Boolean value based on the matching result.

Limits

This function is supported only in Realtime Compute for Apache Flink that uses Ververica Runtime (VVR) 3.0.0 or later.

Syntax

BOOLEAN REGEXP(VARCHAR str, VARCHAR pattern) 

Input parameters

Parameter

Data type

Description

str

VARCHAR

The specified string.

pattern

VARCHAR

The specified pattern.

Note

If the str or pattern parameter is NULL, NULL is returned.

Example

  • Test data

    Table 1. T1

    str1(VARCHAR)

    pattern1(VARCHAR)

    k1=v1;k2=v2

    k2*

    k1:v1|k2:v2

    k3

    NULL

    k3

    k1:v1|k2:v2

    NULL

    k1:v1|k2:v2

    (

  • Test statement

    SELECT  REGEXP(str1, pattern1) AS `result`
    FROM T1;              
  • Test result

    result(BOOLEAN)

    true

    false

    NULL

    NULL

    false