[Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly
-
This forum is fellow users of Notepad++ – we cannot add features. We can only discuss whether we think it’s a good idea or not.
You already created the official issue a week ago, and that is the one and only place where a decision could be made to implement it. If they don’t decide to implement it there, you could post it a billion times in this forum and other places, and it won’t change the fact that it won’t be implemented unless they decide to implement it in the GitHub issues area.
If you had wanted to encourage people to upvote your issue, you should have at least provided a link to it. Since you didn’t provide that link, I can only assume that you got impatient with the official feature-request response after 5 days, and decided to come here instead, hoping that there was no overlap and no one would notice you were duplicating a previous discussion (it didn’t work, if that’s what you were trying).
Also, it’s been requested multiple times – here and and in the official issues. I cannot find any of the recent ones, though I know it’s been talked about recently. But I did find this recent official feature request which is essentially the same: someone asking for a way to save their favorite search expressions long term.
I found this older post from @Alan-Kilborn which shows a “poor man’s regex favorites” workaround, which you may or may not be willing to utilize in the absence of that feature request being implemented.
(This is a really hard discussion or feature request, because everyone will use different terms to refer to the same thing: “pin favorites” or “save search expressions” or “bookmark regex” or … Doing a cohesive historical search on those is hard. Or maybe I’m just having a bad search day. I know this has been requested recently in the forum, and I am sure there are more open and maybe even closed official-feature-requests on that)
-
The OP’s suggestion here in this thread (using a “Library” tab) seems a bit, well, bad for a UI. Especially one that is rather space-limited, like Notepad++'s. I don’t really like the Title/Explanation duality – couldn’t this be combined into one thing?
I think I like the suggestion HERE for EditPlus the best; the UI from there shown below for convenience of reference:
It might be best to take that (the EditPlus example) a bit further and show a populated top list box. I don’t know EditPlus, but I would expect that double-clicking an entry in that top list box would cause the “Find & Replace List” window to close and the double-clicked entry’s parameters to be copied back into the original dialog that had the “List…” button?
There are some additional hurdles for this when thinking about Notepad++ (presuming a “List…” button appears on every tab of the Find dialog tab control), but it wouldn’t be too bad…
I think this might be a good start for a needed Notepad++ feature.
(Of course, I don’t know UltraEdit either, and in the github issue the UltraEdit example wasn’t really shown, but maybe it has some design tidbits to offer as well).
-
@alan-kilborn said in [Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly:
…I would expect that double-clicking an entry in that top list box would cause the “Find & Replace List” window to close and the double-clicked entry’s parameters to be copied back into the original dialog that had the “List…” button?
Of course, clicking OK after making a selection would do the same thing (forgot to say this originally).
-
More thoughts:
- Change EditPlus’s OK button to “Use” (this would also save any unsaved changes to the current entry before “using” it)
- Change EditPlus’s Remove button to “Delete” (delete being a more-common Notepad++ usage) (this was actually OP’s idea); deletion would need to be confirmed
- Change EditPlus’s Up and Down buttons to be more explicit as “Move Up” and “Move Down” to move the currently selected entry up or down
- Add a “Duplicate” button to make a copy of the current entry (if there are unsaved changes to the current entry, save them before doing the duplication)
- Add an “Update” button if the user starts making changes to the current entry’s data (this was actually OP’s idea) but doesn’t want to close the box and “use” the current entry, just wants to save it
- To abort errant changes to the current entry, “Cancel” button would be used (have to re-press the “List…” button to come back in and do more editing)
- When the “List…” button is pressed, if the current find/replace data is not in the list, offer to add it? If it is in the list, make it the current entry for quick-access mods?
-
I’ll weigh in with my ℕ¢:
- Having a Library… button that pops up a second window next to the Find window makes more sense to me than having a separate Library tab: I would think anyone who wanted a library of frequent expressions would want to be able to use them for Find, Replace, Find in Files/Projects or Mark, and that just wouldn’t work well with a Library tab, because you’d keep having to tab between the Library tab and the actual Find or Replace tab as you wanted to access the library.
- I prefer the name Library… for that button instead of List…
- I think Use makes more sense than OK for copying the selected expression to the Find/Replace window
- I do not think that Use should close the Library window… I would want to keep that second dialog open while doing multiple searches or replacements (similar to the way that the Find window stays open to allow for Find Next or modifying the regex without closing the window)
- I agree there should be an Update button – or maybe Modify, with no strong opinion as to which. (I originally thought I liked Modify more, but Update is growing on me)
- I think the “exit the Library” button should be Close rather than Cancel: my reasoning would be that a user might think that Cancel would undo everything done in the Library window – so it would undo adds, deletes, moves, or uses. But I don’t think it’s practical to keep a history of all those events to be able to fully undo everything. One would have to hit Close before doing a Use if one doesn’t want to change the FIND/REPLACE expressions in the Find window; one would have to do a Close before doing an Update if one didn’t want to change the values in that entry in the library. But once Use or Modify or Add or Delete is clicked, I do not think it should be undoable, and Cancel would imply that to at least a large subset of users.
- Definitely offer to add the existing FIND/REPLACE pair to the library when Library… is first opened… but rather than an extra popup for the “offer”, I would just say pre-populate the input fields in the library and make sure that Add is enabled with nothing in the main panel selected. Something like:
-
@peterjones said in [Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly:
@alan-kilborn ,
I’ll weigh in with my ℕ¢:All great points! I think the separate GUI is key since the Find / Replace dialogue and each tab is already very busy - a button to open the new “Library” form consistent on each tab would do the trick along with all the recommendations you all make about the visual elements of that new GUI.
Cheers.
-
Hello, @michael-vincent, @peterjones, @alan-kilborn and All,
Peter, I agree to that @michael-vincent said :
All great points! I think the separate GUI is key
Now, Michael, you said :
a button to open the new “Library” form consistent on each tab would do the trick…
Huuum, I would say that opening this new window with the
Library
button should recapitulate all the parameters, regarding theFind/Replace/Mark
feature. Indeed, for instance :-
You may decide to extend a search, initially done on all opened documents, to some directories, and, possibly, update the library, accordingly
-
You may decide to extend a simple search, already saved, to a search and replace action and add this new S/R to the library
In the opposite way :
- You may decide to modify an initial search and replace saved operation to a simple
Mark
operation, and so on…
Some specific points :
-
What’s about the
Extended (\n, \r, \t, \0, \x..)
search mode ? From your pictures, if theRegular exprresion
is not ticked, this choice forces theNormal
search mode, automatically. Note that I personally never use theExtended
mode but some people may be used to select it ! -
If we suppose that each item of the library will save the states of the
case
andwhole word
boxes, what’s about the other options :-
Backward direction
-
Wrap around
-
. matches newline
-
Filters
anddirectories
fields : -
Bookmark line
-
Purge for each search
-
To my mind, their states should be saved, too as it determines the way the global action is performed !
Now, I’m thinking about a small improvement. Let’s imagine, in the main panel of the new
Find and Replace Library
, something like that :# My SPECIFIC changes in the 'Results.txt' file, exported from the 'Everything' software : - Change the HEADER line - Modify the column's ORDER and the SEPARATORS - Justify the SIZE numbers to the RIGHT
Corresponding, in my case, to the following `S/R`` :
SEARCH "Nom","Chemin","Taille","Extension","Date de modification","Type","Date de création","Horodatage dernier accès","Attributs","Date d'exécution" REPLACE "Nom","Chemin",123456789,"Extension",2021-12-31 23:59:59,"Type",2021-12-31 23:59:59,2021-12-31 23:59:59,"Attributs",2021-12-31 23:59:59 SEARCH (?-s)^"(.+?)","(.+?)",(\d+),".+?",(.+?),.+ REPLACE \1\t\3\t\4\t\2 SEARCH \x20{5}\K(\d+)(\x20+)(?=\x20{5}\d{4}-\d\d-\d\d) REPLACE \2\1
Of course , I do not mean at all that these
3
S/R should be executed in one go !I just mean, that, from my comment header, beginning with a
#
char, the indented items show a group of several independent S/R, which must be sequentially executed against the sameResults.txt
file, to get the needed modifications !Best Regards,
guy038
-
-
opening this new window with the Library button should recapitulate all the parameters, regarding the Find/Replace/Mark feature
I think the intent here is not really to reinvent currently macro-recordable complete actions (Find/Replace/Find in Files/Mark) but rather just to capture the “searchable” part. Thus, something that is part of the “Library” can be used independently of the specific search function. Now, clearly a bit of replace text is only good for a replace (or replace-in-files) action, and so remains unspecified for other types of actions, but things like directory/bookmark/filters/search-direction/etc. (things that don’t impact the direct text search) are not important. I’m not sure how to best say it, but perhaps you get my meaning. If this feature gets over-complicated in its specification, it won’t possibly get implemented.
What’s about the Extended (\n, \r, \t, \0, \x…) search mode ?
Surely an oversight in previous discussions; it should be included. And maybe also worth saying is that “whole word” should be disabled when “regular expression” is selected on an entry.
I’m thinking about a small improvement…
This could be handled by no additional logic/code, but rather by a common prefix on the "Description"s of several sequential entries (can be made sequential with the “Move Up”/“Move Down” buttons if needed).
-
Hi, @michael-vincent, @peterjones, @alan-kilborn and All,
So Alan, if I follow your reasoning, it means that, rather than having the
3
zonesCase sensitive
,Whole word only
andRegular expression
, at the bottom of the window, we should better put the3
modes of searchNormal
,Extended
andRegExp
Then, it would be up to each user to verify the state of the different checkboxes and fields, before starting the whole process. Indeed, they could be considered as flavours of the chosen search mode !
BR
guy038
-
@guy038 said in [Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly:
it means that, rather than having the 3 zones Case sensitive, Whole word only and Regular expression, at the bottom of the window, we should better put the 3 modes of search Normal, Extended and RegExp
Well…I think the following all belong:
- case sensitive checkbox
- whole word checkbox
- search mode dropdown with the obvious 3 choices: Normal, Extended, Regular expression – or maybe 4 choices: Normal, Extended, Regular expression where . matches newline, Regular expression where . doesn’t match newline.
Surely you see that e.g. “case sensitive” is more bound into the search trying to be captured here than something like e.g. “Backward direction”.
BTW, and I probably should have stated this earlier, a design goal with crafting a specification for this is that we don’t go this far with it: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9627 :-)
-
Hi, @alan-kilborn and All,
Yes, your proposition seems sensible ! In this new
Find and Replace Library
window, we should stay concerned about options relative to the WAY of searching and/or replacing.And all the other parameters :
-
Regarding the direction of the search (
Backward direction
,Wrap around
options ) -
Regarding the scope of the search (
Filters:
andDirectory:
fields ) -
Regarding the tracking of the search (
Bookmark line
andPurge for each search
options )
would be defined by the user, before running the process
Thus, this leads to have, at the bottom of that window, two rows of options :
-
Case sensitive
,Whole word
andNormal
-
Extended
,RegExp
andRegExp (Dot=All)
Just a suggestion, of course !
Best Regards,
guy038
-
-
@Taije Park a new feature is a new beginning. I really like your idea.
-
@alan-kilborn ,
After looking at that, I agree, that is a micro management screen. :)
All people really want is something to store their regularly used search expressions in a handy library space with the search and replace menu so it pastes it in and runs it. Anything more than that can overwhelm users, especially novices…which seems to be the dominant species to using the free Notepad++ editor. -
Another recent feature request for this: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11981
-
-
I was just about to post this exact same Feature Request…
I believe that whenever you have RegEx options in Search and Replace, there should be an option to save the Searches…
Constructing RegEx is pain. No one wants to go thought that repeatedly unless necessary :)
Also naming the saved searches is critical because without the name you only have the regex string visible and you must still DECIPHER weeks later what does it do… an explanatory name of the bookmark/preset is crucial for quick and confident re-use
example of self-explanatory saved searches presets
“Replace department codes in HR Quarterly Report”
“Book Reviews - Add TAB after Chapter Numbers”
“AD Data Export - Delete employee number”This request will no doubt keep re-appearing in new GitHub requests and Notepad Community topics…
There are MANY text editors out there that already have this so when i first moved to NP++ it was sad to find out this is missing… still I like NP++ very much but sometimes I keep another editor handy with the search bookmarks for those regular regex operations…
Also please anyone who like this… UPVOTE the original message (Taije Park 18. May 2022 6:28 PM)… so the upvotes are visible in the forum…
-
@Remote-RV This is all the GitHub Feature Requests asking for the same thing (ability to save Search/Replace presets)
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11669
this is the request from Taije Park linking to this Notepad community threadhttps://github.com/notepad-plus-plus/notepad-plus-plus/issues/11309
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4700
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11981
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5823
-
@Remote-RV said in [Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly:
Also please anyone who like this… UPVOTE the original message (Taije Park 18. May 2022 6:28 PM)… so the upvotes are visible in the forum…
I have no problem with encouraging people to upvote certain posts in the forum. But in case there is any confusion on your part or the part of those who read your post: it won’t change anything. What happens here is virtually irrelevant to the decision maker in the github repository. The developer does not hang out in the forum, and he doesn’t look at upvotes on posts here to influence what gets implemented in Notepad++. If you really want to influence things, upvote and comment on the issues in the github repository – because he at least reads new issues, and might notice things like upvotes on a github request.
-
@PeterJones Thanks. Yes I understand. But I didn’t find any button to upvote ISSUE in GitHub.
-
@Remote-RV said in [Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly:
I didn’t find any button to upvote ISSUE in GitHub.
-
@PeterJones Aaaaah ok. I thought this is more of a reaction to individual post. I was wondering if there is like a voting mechanism on the issues as a whole that shows the developers which issues are “most wanted” in the grand scheme of 1900 opened issues… well I guess in the end developers do not decide based on votes anyway… its not that simple :)
but good to know there is THUMB UP