Enhance the search options
-
If I search for a string in a file and if that string occurs twice in a line, then in the search result pane, it will show two lines with that occurrence of the string highlighted. Requesting an option in search window to unify highlighting in same line rather than highlighting in duplicated lines.
-
This feature request has been already adressed here
Cheers
Claudia -
Here’s a semi-workaround:
If you want to do a Find All on the string “abc”, do a regular expression search for ^.*?\Kabc
Although this won’t highlight all of the matches, it only puts a line with MULTIPLE occurrences of “abc” in the search results pane ONCE. It will highlight only the first match on the line.
-
Hello Prabhu and Scott,
Scott, nice work-around, indeed ! I upvoted for it.
Prabhu, there is, also, an other possibility :
-
Select the Search - Mark… menu option
-
Type abc, in the Find what : zone
-
Check the Bookmark line and the Purge for each search options
-
If necessary, check the Match case and Wrap around options
-
Select the appropriate search mode
-
Click on the Mark All button
-
Then, select the Search - Bookmark - Copy Bookmarked Lines menu option
-
Open a new tab ( CTRL + N )
-
Finally, paste the bookmarked lines ( CTRL + V )
However, my method has a disadvantage : it does NOT copy the line numbers, of the matched lines :-((
So, finally, we’re all agree that an option to get ONLY ONE line, with the multiple matched strings highlighted, would be welcome !!
Best Regards,
guy038
P.S. :
I’ve just thought about an other way to get the line numbers, but not the highlighting, unfortunately :
-
Look for any occurrence of abc and send the results to the Find result pane, clicking, as usual, on the Find All in Current Document button
-
Select all the lines found, in the Find result pane, with the mouse
-
Copy these lines with a CTRL + C action
-
Open a new tab ( CTRL + N )
-
Paste these lines with a CTRL + V action
-
Finally, perform the S/R, below, with the Regular expression search mode checked
SEARCH
(?-s)(^\h*(Line \d+:).*\R)(?:^\h*\2.*\R?)+
REPLACE
\1
Et voilà ! You get each line, of the list, only once :-)
-