V
V
Vlad2021-10-01 11:50:23
Regular Expressions
Vlad, 2021-10-01 11:50:23

How to compose regex: anything that doesn't contain the word "slovo1, slovo2"??

How to make a rule to select everything that does not contain slovo1 and slovo2?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2021-10-01
@Sc0undRel

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

D
dollar, 2021-10-01
@dollar

It is possible with the help of negative look forward/backward.
And in other strange ways such as character-by-character checking.
But in general, regular expressions are not designed for complex, intricate logic. And you already have a small database (of two words). It is customary to solve such problems programmatically in two stages:
1) The regular expression finds what is convenient to find exactly the regular expression.
2) And further in the desired programming language:

IF (найденное != "slovo1" AND найденное != "slovo2") .....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question