I am using Notepad++, and I'm trying to find a way where I can search for multiple values on the same line. The regex search is not working for me currently, as I may not know which order the values are in.
For example, I want to search for a line of code which has three specific values. Using .*
in the regex search is not working as you must know the order of the values. Is it possible for me to search for these lines without knowing the order of the values?
On each line I have perhaps a trading log which has 30 different tags.
I want to search for 35=D, EUR/USD, 150=8
. I only want to search for entries with all three values present.
The issue I run into is that the order of these tags are not guaranteed, so the regex search I use below does not always find each entry I require.
35=D.*EUR/USD.*150=8
Best Answer
Using lookahead is much more efficient and can deal with any number of alternations without increasing complexity:
^(?=.*\b35=D\b)(?=.*\bEUR/USD\b)(?=.*\b150=8\b).+$
.
matches newline"Explanation:
Screen capture: