Find All result with lines count in the summary line?
-
I have got a suggestion, please (if it isn’t already possible):
I have searched for “Options” with Find All and get:
Search "Options" (86 hits in 1 file of 1 searched)
…It would be nice if I could see additionaly to the hits count the lines count “in 82 lines”:
Search "Options" (86 hits in 82 lines in 1 file of 1 searched)
-
@datatraveller1 said in Find All result with lines count in the summary line?:
I have got a suggestion
No one that can have an impact will see your suggestion here. Properly, suggestions are made following the advice HERE.
You are seeking, it seems, the number of lines that have one or more search hits. You can get this information by doing a second search in Regular expression mode with
.*
appended to your search text.Example:
aa a bbbb aaaaaaaaaa
Search (using Find All in Current Document) for
a
and obtain:Search "a" (13 hits in 1 file of 1 searched)
Search (using Find All in Current Document) for
a.*
and obtain:Search "a.*" (3 hits in 1 file of 1 searched)
The second search’s 3 hits means that 3 lines had hits.
Note that doing two searches is not a requirement, you can dispense with the first search and only search for
a.*
if you like.You could also use the Count function to obtain the same data (on the status bar of the Find window), but that would additionally require checking of the Wrap around checkbox in order to operate over the entire file.
(Of course, the . matches newline checkbox needs to be unchecked for the aforementioned regular expression searches to work)
-
@Alan-Kilborn ok, I have opened a new issue. If you like you can delete this post here.
-
@datatraveller1 said in Find All result with lines count in the summary line?:
I have opened a new issue.
Traditionally you link it here (if it was discussed here first before a real “issue” is made), but I will do that since you didn’t: LINK.
If you like you can delete this post here.
No sense in that, even if I could do that. :-)
-
@Alan-Kilborn No problem, I have just noticed that you posted additional comments, which I hadn’t seen before my suggestion to delete this thread. These are all useful workarounds - so thank you for that!
-
@Alan-Kilborn said in Find All result with lines count in the summary line?:
a.*
By the way, the reason appending
.*
to a bit of search text works is because it says to the search engine to match the search text specified, then match zero or more occurrences of any character on the line.Since such a match extends from the match of the first bit of search text specified on the line out to the end of the line, a maximum of ONE match per line can occur, no matter how many times the original search text is duplicated on that line.
Thus, you end up with “hit count” = “lines (with matches) count”.
-
By the by, I prefer the technique shown above (with
.*
) to using this Notepad++ setting:Why?
- I feel that setting choice still has some bugs in it :-(
- It is easier to switch between what I want to do at any given time if I can just do it right in the Find window, without having to slog over to Preferences in the UI.
-
Hi @Alan-Kilborn,
I use this “Search Result window: show only one entry per found line
” setting and like it very much because all these duplicate superfluous lines which bothered me are gone :-). I think this setting was introduced only a few months ago. I haven’t encountered any issues yet but of course this does not mean there aren’t any.