Notepad++: Multiple words search in a file (may be in different lines)?
Solution 1
You need a new version of notepad++. Looks like old versions don't support |
.
Note: egrep "CAT|TOWN"
will search for lines containing CATOWN. (CAT)|(TOWN)
is the proper or extension (matching 1,3,4). Strangely you wrote and which is btw (CAT.*TOWN)|(TOWN.*CAT)
Solution 2
<shameless-plug>
Search+ is a notepad++ plugin that does exactly this. You can download it from here and install it following the steps mentioned here
Feel free to post any issues/suggestions here.
</shameless-plug>
Solution 3
Possible solution
- In Notepad++ , click search menu, the click Find
- in FIND WHAT : enter this ==> cat|town
- Select REGULAR EXPRESSION radiobutton
- click FIND IN CURRENT DOCUMENT
Solution 4
If you are using Notepad++ editor (like the tag of the question suggests), you can use the great "Find in Files" functionality.
Go to Search → Find in Files (Ctrl+Shift+F for the keyboard addicted) and enter:
Find What = (cat|town)
Filters = *.txt
Directory = enter the path of the directory you want to search in. You can check
Follow current doc.
to have the path of the current file to be filled.Search mode = Regular Expression
Related videos on Youtube
unirock
Updated on July 09, 2022Comments
-
unirock almost 2 years
How can we perform multiple search for multiple words and the line containing them. These words can be in same or different lines. For example:
1.The CAT goes up and down the ROAD.
2. The DOG goes up and down the CITY.
3. The HORSE goes up and down the TOWN.
4. The DONKEY goes up and down the TOWN.Now, I wish to do a search for the lines containing CAT and TOWN in one shot. So, I would get the output as line 1, 3, 4 in sequence. That would be the same way we do in Unix (
more file | egrep "CAT|TOWN"
).How can we do it in Notepad++??
-
unirock about 12 yearsThanks much Buddy!! (cat)|(town)....it worked pretty well...and easy to remember too !
-
Alex over 9 yearsThis looks to be outdated. New versions have support. see here: stackoverflow.com/a/14727514/265877
-
GroD over 8 yearsamarghosch do you have a windows version of this plugin?
-
GroD over 8 yearsi need a windows version of this plugin for Notepad++ v6
-
Chris Smith over 7 yearsIt would be good if this appeared in the Plugin Manager within Notepad++ for easier install.