PFE's find & extend selection
Is someone aware of a plugin that copies PFE’s find & extend selection functionality?
Alternatively this would be a feature request to enhancde NPP standard.
For those that don’t know PFE, in Find has a checkbox for “Extend selection” meaning that when checked all text from the cursor postion until the first find will be selected allowing quick copying chunks of text out of long files.
In my case it would be extremely helpfull working with saved streams out of streamserve but I can imagine many more usefull cases.
do you know the Begin/End Select feature?
Click on it, do your search and another click selects the text.
If you assign a shortcut I assume you can get faster result than using the mouse
to check a checkbox (which isn’t currently available).
Hello Erik van der Vlugt
You can easily simulate this functionality, by an appropriate regular expression :-))
Two possibilities :
If you want to select from cursor location till the next character, word, string or even regular expression matched, INcluded, just put the regex
(?s).+?, before your search
If you want to select from cursor location till the next character, word, string or even regular expression matched, EXcluded, just put the regex
(?s).+?(?=, before your search and end this regex with a closing round bracket !
If your search is case insensitive, use, at the beginning, the in-line modifier
If your search is case sensitive, use, at the beginning, the in-line modifier
If your search looks for a whole word, only, add the
\bsyntax, just after your search
So, let’s consider the contents of the N++ license.txt
Move back at the very beginning of your file ( CTRL + Origin )
Open the Find dialog ( CTRL + F )
Select the Regular expression search mode
Then, for instance :
(?si).+?Licensewould match from cursor location, till the string License, included, whatever its case ( 15 matches )
(?s-i).+?(?=License)would match from cursor location, till the exact string License, excluded ( 6 matches )
(?si).+?License\bwould match from cursor location, till the word License, included, whatever its case ( 10 matches )
(?s-i).+?(?=License\b)would match from cursor location, till the exact word License, excluded ( 5 matches )
Of course, you regex can, also, be a regular expression, itself ! For instance, the regex
?si).+?Th[eo]sewould match from cursor location till the word those or these, included, whatever its case !
(?s)modifier forces the regex engine to consider that the dot meta-character can match, absolutely, any character ( standard and EOL characters ). So the regex
.+can matches any non-null range of characters, even located on several lines.
The question mark
?, placed after the syntax
.+ensures that the shortest range, between the cursor location and your own search expression, will be selected !
(?=.....)is a positive look-ahead assertion. At cursor position, that condition must be true in order to valid the overall match, although this condition is NOT a part of the final regex to match !
For keeping this Find and Select behaviour, just close the Find dialog, with the ESC key, and go on, hitting the F3 key, for matching the other occurrences !
The very nice thing is that you just select the previous range(s), if you hit the SHIFT + F3 shortcut !