8

Geany, like many text editors, has a Replace dialog:

Geany replace

In the Replace with: field, how to express that I want the pattern to get replaced with a new line character?

13

How to express that I want the pattern to get replaced with a new line character?

  • Set "Replace with" to \n
  • Enable "Use regular expressions"
  • Enable "Use multi-line matching"

Regular expression syntax

enter image description here

Source Regular expression syntax

  • Note: if you have literal "\n" strings in a file and need them replaced with newlines, first do a non-regex replace of "\n" with something like "ThisIsANewLine", and then do the regex replace of "ThisIsANewLine" with "\n" – SteveDonie Oct 13 '15 at 14:47
  • 1
    @SteveDonie If you have a literal "\\n" to replace it is easier to just escape the "\" using "\\n" – DavidPostill Oct 13 '15 at 14:51

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.