how to match a word with regex lookaround only if another word is not nearby?

Viewed 25

I am trying to match coin in a string, but only if the word crypto is not present within the previous three or following three words.

Is this possible in regex?

This should match:

  • The British Museum has the oldest coin in the world on display.

Neither of these should match:

  • HMRC view trading arrangements for a crypto or digital coin as employment income.

  • Binance coin, the native crypto currency of Binance.

Any help would be greatly appreciated :)

0 Answers
Related