Reputation: 2269
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.
Upvotes: 14
Views: 18628
Reputation: 9
Not as elegant, but I just used this:
REGEXP_CONTAINS(UPPER(sources), "CLAIMS")
Upvotes: -1
Reputation: 626903
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 ...
Flags
i
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
).
Upvotes: 36