Menu

Regular expression: \n

2006-09-22
2012-11-13
  • Nobody/Anonymous

    Is there a way to search and replace the \n regular expression?  I want to replace \n\n with just a \n. 

    Thanks.

    Notepad++ is a greate editor.

     
    • Nobody/Anonymous

      I did not find it either. I think it does not work this way.

      I had to find another way.
      1. Select your two blank lines and hit ctrl+H (replace). You will have the selected in the "find what" and put some unique text to "Replace with", eg. "aaaaaaxxxx" and click on replace all (with regular expression NOT checked).
      2. Then take "aaaaaaxxxx" to "find what", place "\n" to "replace with", check the "regular expression" and finish it with "replace all".

      Michal

       
      • Nobody/Anonymous

        This sucks!
        I learned regular expressions on http://www.regular-expressions.info and Notepad regular expressions are just too different.

         
    • pshute

      pshute - 2007-06-18

      See http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo .  I recommend the advanced search without regex. Enter control+M Control+M in the find box, and a single control+M in the replace box.