Page 1 of 1

find some text AND NOT other text

Posted: Fri Jan 31, 2020 8:44 am
by 4EverMaAT
For example, I want to find "Monetary" but exclude that find if the word "Union" comes immediately afterwards.

1 AUD Australia 3 Monetary Policy Meeting Minutes
2 EUR European Monetary Union 2 EcoFin Meeting
3 EUR European Monetary Union 1 ZEW Economic Sentiment
4 EUR European Monetary Union 1 Non-Monetary Policy ECB Meeting FxStreet

Lines 1 (Monetary Policy.....) and Line 4 (Non-Monetary Policy....) is ok.

But Lines 2, 3 (Monetary Union) I want to ignore. There is no other mention of Monetary in that line.

I assume I might need to use regex.

Re: find some text AND NOT other text

Posted: Fri Jan 31, 2020 11:05 am
by DigitalVolcano
Negative lookahead Regular Expression should do it-

Regex:

Code: Select all

Monetary(?! Union)

Re: find some text AND NOT other text

Posted: Wed Jul 13, 2022 10:45 am
by 4EverMaAT
DigitalVolcano wrote: Fri Jan 31, 2020 11:05 am Negative lookahead Regular Expression should do it-

Regex:

Code: Select all

Monetary(?! Union)
These type of examples need to be included in the regex reference guide. Or you can point to a good online reference guide. I will also link to this for the 4.x suggestion.