Search two or more phrases in one single line
-
Example i have a log file with a line with this contents
2020-12-10 01:01:48 185.248.238.155 EG12S009\7306 FTPSVC2 EG12S009 - 10.45.13.4 21 STOR AP_7306202012100200.lck 226 0 0 66 47063747 19469 90d40aa2-936c-424f-a1e2-63141adfa8f2 /Qdisplay/AP_7306202012100200.lck -
To finding this line i want to search for “STOR AP_7306” and “185.248.238.155”
How todo within Notepad++
Thanks for responding…
Rob
-
To clarify, do you want to
- Find all lines that have both, in the order you listed
- Find all lines that have both, in either order
- Find all lines that have at least one of those two words
Are you going to want to
- Just easily go to that line using “find next”
- highlight one or both of the matching words on that line
- bookmark all the lines that match
- do some sort of “replace” operation that you haven’t told us about
- delete all the lines that match
- delete all the lines that don’t match
----
Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as plain text using the
</>
toolbar button or manual Markdown syntax. Screenshots can be pasted from the clipboard to your post usingCtrl+V
to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get… Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries. -
For this one, I’d go with the simplest explanation possible based upon what was provided, and let the OP sort it out from there.
find:
(?-s)(?=.*STOR AP_7306)(?=.*185\.248\.238\.155).*
search mode: regular expressionto extend to “or more”, do it like this:
find:
(?-s)(?=.*STOR AP_7306)(?=.*185\.248\.238\.155)(?=.*orMore)(?=.*orMore2).*
perhaps you can see the pattern in the “orMore” stuff?