I want to save a replace operation like “(A?)(B?)” -> “AA$1BB$1” and play it later on demand

]]>https://notepad-plus-plus.org/community/topic/15717/can-i-store-record-regex-replace-operations-then-run-them-laterRSS for NodeFri, 22 Feb 2019 14:17:53 GMTFri, 04 May 2018 06:42:16 GMT60I want to save a replace operation like “(A?)(B?)” -> “AA$1BB$1” and play it later on demand

Of course, a trivial solution could be to store all your Search / Replacement couple of regexes in a specific file, containing your preferred S/R operations, in order to select them again when you would like to perform a specific an/or complicated S/R !

Meanwhile, you may be interested by a Python script, created by @claudia-frank, ten months ago !

]]>https://notepad-plus-plus.org/community/topic/15717/can-i-store-record-regex-replace-operations-then-run-them-later/2https://notepad-plus-plus.org/community/topic/15717/can-i-store-record-regex-replace-operations-then-run-them-later/2Fri, 04 May 2018 11:13:57 GMTPerhaps the OP would be interested to know (if s/he doesn’t know already) that replace operations can be stored as a macro and then run later via a simple custom-named choice on the Macro menu. To set this up, experiment with these Macro menu (or toolbar, in some cases) items:

Start Recording

Stop Recording

Save Currently Recorded Macro.

Note that when recording a very simple macro, for example, one that does a single replace operation, that you only need to wrap the Start and Stop recording operations around the button press that actually does the action (the Replace button in this case).

All of the other actions in setting up a replacement (filling in the Find what zone, the Replace with zone, the search options and mode, etc) aren’t recorded as you navigate the user interface, but rather are “snapshotted” into the macro when the Replace button is pressed.

I find this handy as I can get the actions correct (e.g. try them out) without worrying about putting a bunch of actions I end up not wanting into the macro. When I’m happy with my replacement parameters, I start recording, press Replace, stop recording, save/name it, and I am DONE.