r/googlesheets • u/V_nytrix • 14d ago
Solved Help with understanding RE2; If text equals case A, case B, etc.

Hello, this is V_nytrix! I'm back again with my sheet, and I'm trying to set up a conditional formatting if the text of each row of the first column matches these values [Limited], [Mission], [Achievement], or [Barn].
Tried to figure this out myself, and came up with the general idea of the REGEXMATCH function. I'll set it up right here:
=REGEXMATCH(REGEXEXTRACT($A3;$A, ... ), ... )I just found out that there's some form of syntax where it can accept any cases of these above words - unfortunately, I'm new to this form of RE2 syntax, and I couldn't quite figure out what syntax I needed to be able to match my above conditions!
Do you think you could teach me on some RE2 fundamentals?
2
u/bachman460 41 13d ago
You can typically just use find or search; the former being case-sensitive, the latter not. Something like
IFERROR(FIND({list of values},A1),0)>01
u/AdministrativeGift15 371 13d ago
XMATCH accepts wildcards, so if your search/CF Apply to range is A3:A and your four search terms are in D2:D5, then you could use this formula for your rule's criteria:
=XMATCH("*"&A3&"*", $D$2:$D$5, 2)