FAQ #109
-
Hello, author, please ask: I need to execute the command only once (I use the shortcut key) and replace it twice to achieve the following purposes:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Keep in mind, not every replace action is well suited for a simple find and replace, some may require you to write an actual script. I don't really have enough information from what you are showing me to even guess as to whether your case is well suited for RegReplace. At the very least, you would need to provide a minimal example: text buffer to operate on, regex rules you've tried along with the configured command, etc. |
Beta Was this translation helpful? Give feedback.
The only way to pull off what, in the way that you want to, is to capture both the header and the date in one search so you have access to all the required capture groups in one find/replace. This is a simple example that is similar but not the same.
While it may be possible, this is not really the most efficient approach.
RegReplace does not have a way to find something and copy it for use in later patterns. Everything that is to be replaced must also contain all the context needed for the replace.
To be honest, this particular case probably would be best done with a script written specifically for the task.