I've got a long google sheets QUERY
, part of which is this:
=QUERY(LOOKUP!$A$4:$H,"Select count(B) where UPPER(D) matches 'OK' and UPPER(H) matches '.*(?:^|,|,\s)"®EXEXTRACT(REGEXREPLACE($Q3,"\s|-",""),"
\w+
")&"(?:,\s|,|$).*' and (UPPER(C) contains '"®EXEXTRACT($Q3, "\{(\w+)\}")&"' or UPPER(F) contains '"®EXEXTRACT($Q3, "\{(\w+)\}")&"') limit 1 label count(B) ''",0)
Basically if I have an entry like apple {pear}
, I only want the apple bit to be matched as part of the query. This works absolutely fine except if I put an &
in the bit to match eg. apple&banana {pear}
the match fails even though apple&pear
is definetely present in the lookup so I think the issue is with my RegEx
. I've tried just replacing \w+
selector at the seperated spot in in the RegEx
with .*
above but no luck.
Any help would be much appreciated