Search with two strings in line
-
Hi
I want to search for lines in a text file, that contains the following two strings “CATALOG” and “FINISHED” somewhere in the line.Example:
12:42:35,700 CATALOG [LSG_BRN_Gleisabschnitt_0021] FINISHED OK
–> This is a valid result12:42:35,700 TEST [Testfall Gleisabschnitt BRN-GA_0021] FINISHED OK
–> This is not a valid result, since the string “CATALOG” is missing in the line.How can I do such a search?
Thanks Peter -
@Peter-Reichmuth said in Search with two strings in line:
How can I do such a search?
I know this was presented in the forum and after a while I found it. Try reading this post. It’s the AND option you need to look at.
Terry
-
Hello, @peter-reichmuth and All,
Easy with regexes !
-
Open the Find or Mark dialog (
Ctrl + F / Ctrl + M) -
SEARCH / MARK
(?-is)^.*CATALOG.*FINISHED.*\R? -
Tick the
Wrap aroundoption -
Select the
Regular expressionsearch mode -
Ckick on the
Find NextorFind All in Current DocumentorMark Allbutton
=> Every complete line, containing these two strings, in this order, are selected or marked !
In case that the word FINISHED may come before the word CATALOG, prefer that second version :
- SEARCH / MARK
(?-is)^.*(?:CATALOG.*FINISHED|FINISHED.*CATALOG).*\R?
Best Regards,
guy038
-
-
Hi, @peter-reichmuth and All,
Re-reading the post that @terry-r referred to, indeed, you may use that more simple solution :
SEARCH / MARK
(?-is)^(?=.*CATALOG)(?=.*FINISHED).+\R?=> The complete lines, containing, both, the strings
CATALOGandFINISHED, whatever their respective order, should be selected or marked !BR
guy038
-
@guy038 and All
Thank you very much for your quick help!
The solution works perfect and fits my need.
Peter -
@Peter-Reichmuth please, exactly which one of the solutions work *perfectly
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login