In Google BigQuery I wanted to check for 'confirm' or 'Confirm':
REGEXP_CONTAINS(h.page.PagePath, r'Confirm') or
REGEXP_CONTAINS(h.page.PagePath, r'confirm'))
I am a Perl person and in Perl we do
$foo =~ /confirm/i # case-insensitive
Does Google BigQuery have any flags to modify REGEXP_MATCH? I did not see any examples in their online docs.
I was stunned when some of my BigQuery queries were taking a minute or so, instead of the usual few seconds. The culprit: Case insensitive searches.
Case Sensitivity – Unlike most RDBMS, BigQuery is case sensitive, not only for string comparison, but for object names as well.
5) BigQuery Regex: RegexP_REPLACE RegexP_REPLACE takes three inputs, value, regular expression, and the replacement argument. It returns a string where all substrings that match regular expressions are replaced with replacement arguments.
If you want to remove a specific character from your String then you can use the Trimming function to do so. Based on the position of the character that you wish to remove there are three kinds of BigQuery String Functions: TRIM (value1[, value2]): It removes all the leading and trailing characters that match value2.
REGEXP_CONTAINS
uses RE2 library, so you may use inline modifiers like this:
REGEXP_CONTAINS(h.page.PagePath, r'(?i)confirm')
^^^^
See RE2 docs:
(?flags)
set flags within current group; non-capturing ...
Flagsi
case-insensitive (default false)m
multi-line mode:^
and$
match begin/end line in addition to begin/end text (default false)s
let.
match\n
(default false)U
ungreedy: swap meaning ofx*
andx*?
,x+
andx+?
, etc (default false)
Flag syntax isxyz
(set) or-xyz
(clear) orxy-z
(setxy
, clearz
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With