Menu

Searching EndOf Line with Regular expressions

2007-10-16
2012-11-13
  • Nobody/Anonymous

    Is it possible to search (and replace) end of line characters in notepad ++ ?
    Let's say the scenario is:

    Line1
    Line2
    Line3

    I need to replace this to:

    Line1,
    Line2,
    Line3,

    I tried several combinations of [.]$, []$, none of which seem to work.
    Any ideas ?

    Thanks in advance,
    MB

     
    • Nobody/Anonymous

      Try replacing CTRL+M by CTRL+M and a comma.

       
      • Nobody/Anonymous

        Nobody,

        I'm assuming when you are saying:

        "Try replacing CTRL+M by CTRL+M and a comma."

        That you mean place your cursor in the "Find What:" field and then hold the control key and press the "M".  I'm sorry to be so verbose, but I'm using Notepad++ v4.4 and every time I try this windows dings at me instead of placing a special character in the field.

        (I've tried both left and right control keys.)

         
        • Nobody/Anonymous

          You should use the CTRL+R Find/Replace Dialog for these actions.

           
          • pshute

            pshute - 2007-10-17

            Last time I tried this, control+M would only work with the advanced find/replace (control+R) if regex was turned off.  See http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo for details.

             
    • Harry

      Harry - 2007-10-16

      find: (.*)$
      replace: \1,
      should work