Felipe Hoffa
Felipe Hoffa

Reputation: 59235

Does BigQuery support regular expressions flags?

I want to do a case insensitive REGEX_MATCH and I'm not sure if I can use flags.

Upvotes: 8

Views: 3456

Answers (1)

Felipe Hoffa
Felipe Hoffa

Reputation: 59235

BigQuery uses re2 for regular expressions, and re2 does support flags.

For example, to do a case insensitive match:

SELECT REGEXP_MATCH('TomatoPotato', r'TOpo')
false

SELECT REGEXP_MATCH('TomatoPotato', r'(?:TOpo)')
false

SELECT REGEXP_MATCH('TomatoPotato', r'(?i:TOpo)')
true

Upvotes: 13

Related Questions