Skip to main content
Version: 24.3.x

Categories: String, Regular Expressions

REGEXP_COL_LIKE

Returns whether a string matches a regular expression in a column.

Syntax

REGEXP_COL_LIKE(input string, regex string) → boolean

  • input: The string to test.
  • regex: The column containing the Perl-compatible regular expression (PCRE) to use for the test.

Examples

REGEXP_COL_LIKE example
SELECT Category, REGEXP_COL_LIKE('WARRANTS', Category)
FROM Samples."samples.dremio.com"."SF_incidents2016.json"
LIMIT 3
-- Category, EXPR$1
-- WEAPON LAWS, false
-- WEAPON LAWS, false
-- WARRANTS, true
REGEXP_COL_LIKE example
SELECT Category, Descript, REGEXP_COL_LIKE(Descript, Category)
FROM Samples."samples.dremio.com"."SF_incidents2016.json"
LIMIT 3
-- Category, Descript, EXPR$2
-- WEAPON LAWS, POSS OF PROHIBITED WEAPON, false
-- WEAPON LAWS, FIREARM, LOADED, IN VEHICLE, POSSESSION OR USE, false
-- WARRANTS, WARRANT ARREST, false

Usage Notes

If your regular expression is a literal, use REGEXP_LIKE.