BigQuery是否支持正则表达式标志?

时间:2021-12-29 14:56:14

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

我想做一个不区分大小写的REGEX_MATCH,我不确定我是否可以使用标志。

1 个解决方案

#1


9  

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

BigQuery将re2用于正则表达式,而re2确实支持标志。

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

#1


9  

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

BigQuery将re2用于正则表达式,而re2确实支持标志。

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