REGEX_CONTAINS not functioning as expected in Bigquery

Viewed 53

So I have an example string type column in Bigquery that contains data like this:

abc_def

or

|def|ggg|abc

And I am trying to capture the abc by using REGEX_CONTAINS(lower(column_name), r'b\abc\b) but the condition returns false as if it's not functioning properly and reading the abc (we've built it this way so that we capture the exact phrasing needed).

What am I doing wrong?

1 Answers

If you just need to check beginning and end of string for your matching, below should work

REGEXP_CONTAINS(lower(column_name), r'^abc|abc\s?$'

Sample testing with output:

enter image description here

Related