Menu

RegEx with newline characters

Help
2005-11-14
2013-04-26
  • Robert Brinton

    Robert Brinton - 2005-11-14

    I have a file that was generated as 'double-spaced' by inserting two newline characters between each line. I was hoping to use a regex search and replace to convert the file to 'single-spaced' by replacing two newlines '\n\n' with one newline '\n'.

    I have since failed to be able to even find two consecutive newline characters. Searching for '\n\n' with regex on finds no matches.

    Is this a limitation of the regex used or am I doing something wrong?

     
    • Marc Kerbiquet

      Marc Kerbiquet - 2005-11-16

      The search commands search only text inside a single line, so a \n will never match.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.