Can I search and replace in a Notepad++ macro?

Yes you can, I just tried to record a new macro, did a search and replace and it successfully saved the action so when I played the macro, it did the same search and replace action.

I am not an expert at Notepad++ Macros, but I am guessing you are... I opened a random file and created a macro called test. It looked for a word called "snip" and replaced it with "blaa".

Opening up the shortcuts.xml file after closing Notepad++ reveals this new macro:

<Macro name="test" Ctrl="no" Alt="no" Shift="no" Key="0">
    <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
    <Action type="3" message="1601" wParam="0" lParam="0" sParam="snip" />
    <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
    <Action type="3" message="1602" wParam="0" lParam="0" sParam="blaa" />
    <Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
    <Action type="3" message="1701" wParam="0" lParam="1608" sParam="" />
</Macro>

This is tested and works on my machine, I can manually modify this file and the changes get reflected and work in Notepad++.

Please note however, the shortcuts.xml file (located in your Appdata folder), only gets loaded and saved on opening/exiting Notepad++.


I previously found that this didn't work for me either. But then I updated from Notepad++ 5.6.x to 5.9.8, and now I can record find-and-replacing just fine. Very nice!

Of course, manually editing shortcuts.xml after recording one is inevitable because there is no a macro editor, and you need super human concentration for recording a huge macro flawlessly. (Make sure all instances of Notepad++ are closed before editing that file.)