Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 840
Felipe Hoffa Avatar asked Jul 09 '14 23:07

Felipe Hoffa


1 Answers

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
like image 116
Felipe Hoffa Avatar answered Sep 21 '22 17:09

Felipe Hoffa