Regexp Functions
regexp_count
Returns the number of occurrence of pattern in string.
Supported Signatures
function regexp_count(varchar, joniregexp) returns bigint
regexp_extract
Returns the first substring matched in a string by the regular expression pattern.
Examples:
SELECT REGEXP_EXTRACT('email_address@gmail.com', '@(.*?)\.' -- value 'gmail'
Supported Signatures
function regexp_extract(varchar, joniregexp) returns varchar
function regexp_extract(varchar, joniregexp, bigint) returns varchar
regexp_extract_all
Returns the substrings of a string matched by the regular expression pattern.
Supported Signatures
function regexp_extract_all(varchar, joniregexp) returns array<varchar>
function regexp_extract_all(varchar, joniregexp, bigint) returns array<varchar>
regexp_like
Evaluates the regular expression pattern and determines if it is contained within string.
Examples:
SELECT REGEXP_like('email_address@gmail.com', '.*@.*\..*') AS is_valid_email -- value 'TRUE'
Supported Signatures
function regexp_like(varchar, joniregexp) returns boolean
regexp_position
Returns the index of the first occurrence (counting from 1) of pattern in string. Returns -1 if not found.
Supported Signatures
function regexp_position(varchar, joniregexp) returns bigint
function regexp_position(varchar, joniregexp, bigint) returns bigint
function regexp_position(varchar, joniregexp, bigint, bigint) returns bigint
regexp_replace
Removes every instance of the substring matched by the regular expression pattern from string.
Examples:
SELECT REGEXP_REPLACE('text foo another text', 'foo', 'bar') -- value 'text bar another text'
Supported Signatures
function regexp_replace(varchar, joniregexp, function(array<varchar>, varchar)) returns varchar
regexp_split
Splits string using the regular expression pattern and returns an array. Trailing empty strings are preserved.
Supported Signatures
function regexp_split(varchar, joniregexp) returns array<varchar>