I am looking for the following words in my document:
"substr"
"500"
"description"
I am using the following expression to try and match this:
(substr|500|description)
That works to find any of these words, but I want to jump to lines that only contain ALL of these words. Is there any way to do this? I don't want an OR condition, I want to AND on all of these words.
So for example:
test substr line one
test substr, 500 line two
test substr, 500, description line three <<--- only go to this line when I hit next!!
Is this possible?
To match them in any order you can use positive lookaheads ?=
:
((?=.*\bsubstr\b)(?=.*\b500\b)(?=.*\bdescription\b).*)
To match them in the given order is much easier:
.*substr.*500.*description.*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With