Home > Software design >  REGEX_CONTAINS not functioning as expected in Bigquery
REGEX_CONTAINS not functioning as expected in Bigquery

Time:09-14

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?

CodePudding user response:

I don't know if this is helpful, but you can test your regexp using regex101.com

CodePudding user response:

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

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

Sample testing with output:

enter image description here

  • Related