As part of a countif I'm trying to search for a cell contents that may contain {}
. It also needs to be constrained to an exact match within the range. So my first hunch is to go with regexmatch
but I'm having issues with the {}
becoming part of the regex. I basically need a way of escaping the entire string from the cell. Here's what I've been trying as an example:
REGEXMATCH(A2,"(?:^|\s)("&A1&")(?:\s)")
So say A1
is blue{car}
and A2 is like a blue{car}
, this should match. However I just get a #REF!
error as its trying to use the {}
as a quantifier. I know you can escape characters in a predetermined string but as A1 could actually be anything I need a general approach. It seems \Q…\E
wrapped around "&A1&"
would be perfect but unfortunately its unsupported in sheets.
Any assistance with this gratefully received!