Regular Expression Functions
Perform pattern matching and text manipulation using regex.
REGEXP_CONTAINS( <expr>, <regexp_pattern>)
Returns TRUE if the value is a partial match for the regular expression.
Supported data types, string and integer
> SELECT REGEXP_CONTAINS('abc', '[a-z]{3}');
TRUEREGEXP_REPLACE( <expr>, <regexp_pattern> , <replacement> )
Returns a STRING where all substrings of value that match regular expression regexp are replaced with replacement. replacement is optional, by default it is empty.
Supported data types, string and integer
> SELECT REGEXP_REPLACE('Customers - (NY)','\(|\)','');
Customers-NYREGEXP_EXTRACT( <expr>, <regexp_pattern> )
Returns the first string from the string <expr> that matches <regex pattern>.
Supported data types, string and integer
> SELECT regexp_extract('1a 2b 14m', '\d+')
1REGEXP_EXTRACT_ALL( <expr>, <regexp_pattern> )
Returns an array of all substrings that match the regexp. Returns an empty array if there is no match.
Supported data types, string and integer
REGEXP_COUNT ( <expr>, <regexp_pattern> )
Returns the number of times that a regexp pattern occurs in a string.
Supported data types, string and integer
REGEXP_LIKE ( <expr>, <regexp_pattern> )
Evaluates the regular expression pattern and check if it is contained within string. It returns True if regexp pattern is present in the expression.
Supported data types, string and integer
Note -
Regular expression functions use the Java pattern
Right now, we have tested on character class and pre-defined character class
Limitations -
Complex types such array, struct or map are not supported for querying with regular expressions
Last updated
