There were few problems setting the keyboard shortcuts, context actions, search replace while running Geany editor on Windows OS.
One of the instances was to search replace empty lines while running Geany on windows. How to use regular expressions to remove empty lines ?
Well it's just simple,
To make it work on Windows where the line ending is CRLF and not just LF (line feed). The line ending has to set to unix style.One of the instances was to search replace empty lines while running Geany on windows. How to use regular expressions to remove empty lines ?
Well it's just simple,
Search for: \n\n
Replace with: \n
Document -> Set Line Endings -> Convert and Set to LF (Unix)


This doesn't always work, use regex & multiline matching - yes, but as pattern use \n^$ meaning "new line" followed by "start of the line" and "end of the line" right after = empty line; and replace it with nothing.
ReplyDeletecan't believe it was that simple.
ReplyDeletePattern '....\n^$' did not work for me in Geany 1.36.
ReplyDeletePattern '....$\n' does work to delete the whole including newline.