L
L
leham12021-10-26 20:24:48
Python
leham1, 2021-10-26 20:24:48

How to exclude a word from a regular expression?

Hello.
Tell me please. How can I make a regular expression match the word "good" only if it is not preceded by the word "very".
For example, in the sentence below, the first word "good" should be found, and the second should not be found.
Sentence:
"one two three good four five very good six seven".

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2021-10-26
@leham1

https://regex101.com/r/w3EadB/1

A
Alexander Ananchenko, 2021-10-26
@Shurik24

Just this afternoon I watched a good video on how to create regular expressions, I recommend watching
Well, I tried it :D

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question