‘containing’ line numbers from Find window not copied anymore
-
From version Notepad++ v6.7.9 (Jun 9 2015) (tested with v6.7.9.1 (Built time: Jun 20 2015 – 11:29:14)) Notepad++ doesn’t copy the ‘containing’ line number anymore from the Find results window. It still does show duplicate lines if there are multiple matches for the same line number.
Due to the missing (containing) line numbers it is difficult to determine which lines are duplicates after copying these lines.
In earlier version (e.g. with v6.7.8.2 (May 23 2015)) it did copy the containing line numbers from the Find results window.Possible related to: https://notepad-plus-plus.org/community/topic/10423/copy-text-from-search-text-in-folders
Question1: Is there a setting to get the old behavior back?
Question2: Is it possible to show only one line in the Find results window, even if there are multiple matches?
Answer2 (from 2010): Yes using regex: http://superuser.com/questions/181002/notepad-ignoring-search-results-on-same-lineExample:
This is just an line, with line number 1.
This line contains only one time the word apple, on line 2.
This is just an line, with line number 3.
This line contains the word apple two times, so one more apple in this line with line number 4.
This is just an line, with line number 5.
This is just an line, with line number 6.
This is just an line, with line number 7.v6.7.8.2 behavior:
Line 2: This line contains only one time the word apple, on line 2.
Line 4: This line contains the word apple two times, so one more apple in this line with line number 4.
Line 4: This line contains the word apple two times, so one more apple in this line with line number 4.v6.7.9.1 behavior:
This line contains only one time the word apple, on line 2.
This line contains the word apple two times, so one more apple in this line with line number 4.
This line contains the word apple two times, so one more apple in this line with line number 4.(with use of regex:
.apple.
v6.8.2 behavior (and probably all version):
This line contains only one time the word apple, on line 2.
This line contains the word apple two times, so one more apple in this line with line number 4.) -
Hello Ron,
Indeed, from the Find result panel, you can, either, copy :
-
All the lines, WITHOUT any line number ( New added feature from the 6.7.9 version )
-
A block of lines, WITHOUT any line number ( New added feature from the 6.7.9 version )
-
ALL the lines, WITH all the line numbers ( the old copy behaviour )
-
A block of lines, WITH all the line numbers ( the old copy behaviour )
Let’s suppose you searched for the string the, in your current file. Firstly, Right click, anywhere inside the Find result panel. Then, choose the Select All option
Now, to get, in the clipboard :
-
All the lines, WITHOUT any line number : Immediately, select the new Copy option
-
All the lines, WITH the line numbers : Immediately, hit the CTRL + C shortcut
-
A block of lines, WITHOUT any line number : Immediately, select some consecutive lines, even partially, with the mouse. Then, Right click, inside the Find result panel, and choose the Copy option
-
A block of lines, WITH the line numbers : Immediately, select some complete consecutive lines, with the mouse. Then, hit the CTRL + C shortcut
To end with, open a new document and just paste your selection :-))
Et voilà !
Tested with the 6.7.9 and 6.8.1 N++ versions !
Here are, below, some nice regexes, which displays ONLY
1
or2
lines, in the Find result windows, EVEN IF there are several matches for an unique line. Let’s keep our previous example string the-
The regex
^.*?\Kthe
displays an UNIQUE line, which highlights the FIRST occurrence of the string the -
The regex
.*\Kthe
displays an UNIQUE line, which highlights the LAST occurrence of the string the -
The regex
^.*?\Kthe.*the
displays an UNIQUE line, which highlights the range, between the FIRST and the LAST occurrence of the string the -
The regex
^.*?\Kthe|.*\Kthe
displays TWO lines, which highlights the FIRST, then the LAST occurrence of the string the
Notes :
-
To look for the simple article the, ( and not, for instance, the words Therefore, another or bathe ), just surround your string, with the
\b
boundaries :\bthe\b
-
If your string or regex, to search for, is quite long or complicated, use, preferably, a group, with a subroutine call, in the third and fourth regexes :
^.*?\K(the).*(?1)
and^.*?\K(the)|.*\K(?1)
Best Regards,
guy038
-
-
Hi Guy,
Thanks for your explanation, really helpful.
This knowledge will probably make me upgrade to a more current release.Is there an accidental difference between CRTL-C and Copy via the pop-up menu, or is this behavior a (documented) feature?
Thanks!
Ron
-
Hi Ron,
When the new copy behaviour, was implemented in N++ v6.7.9, as I’m rather curious, by nature, I just tested a way to get the old behaviour too ! And I found, by hazard, the simple CTRL + C shortcut, to simulate it :-)
An obvious solution would be to get two COPY options, while right-clicking, inside the Search Result Window.
For instance, their syntaxes could be something like :
-
Copy [selected] text , to copy the lines with their line numbers
-
Copy [selected] lines, to copy ONLY, the text of the lines
Cheers,
guy038
-