regex – REGEXP_LIKE word boundary in Snowflake

REGEXP_LIKE:

The function implicitly anchors a pattern at both ends (for example, ” automatically becomes ‘^$’, and ‘ABC’ automatically becomes ‘^ABC$’). To match any string starting with ABC, the pattern would be ‘ABC.*’.

String functions (regular expressions)

In single-quoted string constants, you must escape the backslash character in the backslash-sequence. For example, to specify \d, use \\d.

i Enables case-insensitive matching.


Query:

select regexp_like(lower('A path down to the street'), '\bpath\b');
-- FALSE

should rather be:

select regexp_like('A path down to the street', '.*\\bpath\\b.*', 'i');
-- TRUE

Read more here: Source link