I want to check if in a cell there is one word but not another. In this post there was some buzz around this matter but the elected solution included a script function. There has to be an easier way to do that.
I want to check if in the string "investimentos" the string "investimentos" is present and "fundos" is not.
I've already tried those below (disclaimer: I'm a beginner with regex):
=regexmatch("investimentos";"(investimentos)^(fundos)")
=regexmatch("investimentos";"(investimentos).*^(fundos)")
=regexmatch("investimentos";"(investimentos)(^fundos)")
=regexmatch("investimentos";"(investimentos).*(^fundos)")
I'm always getting false. Why is that?
=AND(REGEXMATCH(A1;"word1");NOT(REGEXMATCH(A1;"word2")))
– Beniamino^[^I]*GO[^I]*$
will match a string that has noI
but containsGO
, but in case there are multiple chars in that word, it won't work. – Beniaminoregex
tag info page has some general notes on negation in regular expressions. – Waal