@Darkwood-Consulting said in Help with a couple of Macros:
Move to the end of the next non-blank line
I’ve come up with a revised version as the previous one looks like it failed when there weren’t any more “non-blank” lines in the file. So now the regex is:
(?-s)(.+)?(\R+)?(.+)?\K
So this is used in the Find function. Copy the red text above (the actual regex) and paste into the “Find What” field of the Find function. Have one of your files open and do a few tests by putting the cursor in various locations and clicking on “Find Next”. You need to test all possible scenarios you might encounter to be sure this will meet your needs.
So once a regex has been found to work, next comes the step of recording the macro. Whilst I’m aware you already have some knowledge of how to record a macro, I’m not sure if you’ve got past the basics of recording a shortcut key combo. To record this macro, you would start the recording as you normally do, then either use the mouse to click on the “Search” menu item, then “Find” or use the appropriate shortcut key for “Find” of which the default is “Ctrl F”. You will see this alongside the menu option. If you have already done some tests a working regex will already be available. Just make sure it is listed in the Find What field. Click on “Find Next” and then click on close. At this point you can stop recording the macro, save and name it.
To give a bit of background to the regex:
(?-s) - DOT characters do not include carriage return/line feeds
(.+)? - consume as many characters as possible on the current line, ? allows for an empty line
(\R+)? - consume as many carriage return/line feeds as possible from the current position (which is the end of a line), ? allows for a non-empty line. After this the cursor will be at the start of non-empty line or end of file
(.+)? - consume as many characters as possible on the current line, ? allows for an empty line/end of file position
\K - forget everything selected and leave the cursor in the new position
Terry
PS, although you refer to a blank line, are you sure it is truly empty, not just containing some blank characters as that changes the solution. Good luck.