Does BigQuery support regular expressions flags?

后端 未结 1 400
天命终不由人
天命终不由人 2021-01-05 08:26

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

1条回答
  •  时光说笑
    2021-01-05 08:33

    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
    

    0 讨论(0)
提交回复
热议问题