nrad
nrad

Reputation: 93

Regular Expressions contains in bigquery example

I need to write regular expressions in bigquery to match the following two under title column: I want to get exactly these two. There are some other values containing 3 Percent, but I want to get only these two.

WBC - SAV - 3 Percent Q4 FY20

Canstar - canstar.com.au - AFF: Table Listing - Cost per click - National - 1x1 - 3 percent Savings

My code is:

WHEN REGEXP_CONTAINS(title, '(?i) 3 Percent') THEN '3% PF'

I am not getting the correct output. Can anyone please assist.

Upvotes: 0

Views: 80

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 173210

There are some other values containing 3 Percent, but I want to get only these two.

So, in this case you don't need regular expression and rather use below

WHEN title IN (
  'WBC - SAV - 3 Percent Q4 FY20', 
  'Canstar - canstar.com.au - AFF: Table Listing - Cost per click - National - 1x1 - 3 percent Savings'
) THEN '3% PF'

Upvotes: 1

Related Questions