Skip to main content

REGEXP_LIKE

Categories: String, Regular Expressions

REGEXP_LIKE

Returns whether a string matches a regular expression.

Syntax

REGEXP_LIKE(input string, regex string) → boolean

  • input: The string to test.
  • regex: The Perl-compatible regular expression (PCRE) to use for the test. Must be a literal.

Examples

REGEXP_LIKE example
SELECT REGEXP_LIKE('the data lakehouse', '.*?\Qlake\E.*?')
-- True
REGEXP_LIKE example
SELECT Category, REGEXP_LIKE(Category, '.*?\Q-\E.*?') 
FROM Samples."samples.dremio.com"."SF_incidents2016.json"
LIMIT 5
-- Category, EXPR$1
-- WEAPON LAWS, false
-- WEAPON LAWS, false
-- WARRANTS, false
-- NON-CRIMINAL, true
-- NON-CRIMINAL, true

Usage Notes

This function is identical to the function REGEXP_MATCHES.