M HYPE SPLASH
// updates

geany editor match newline

By Abigail Rogers

I have a plain text file with a large number of lines with a blank line between each pair of lines. I want to remove the empty lines.

I am trying using the Replace dialog with regex, to replace '\n\n' with '\n', but the search does not recognize '\n' as the new line character.

In the Files pane of the Preferences dialog, the 'default end of line character' is set to Unix (LF) and with 'View/Show Line Endings', each line is terminated with a 'LF' icon -- or what looks to me to be an icon.

I have tried \p and \r but they don't work either.

It is a plain text file so I know there are other approaches to removing the blank lines, but I am interested in what's going on here with geany. How could I do this using the geany replace dialog?

Update I can get a match using $ as the search key but the replace all does not replace the endline character, it instead inserts before it.

3

1 Answer

In the replace options, check both:

  • Use regular expressions
  • Use multi-line matching

Then \n works.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy