Search and replace

  • i cannot fix the regular expressions for that :/

    Suppose you have this text:

    some text [1 Box]
    somer other text [200 Boxes]

    i would get this text:

    some text
    some other text

    (Value 1<) Thank you.

  • See the last post (5/23/17) in this thread:

    Npp can’t do it automatically by copy-and-paste. You need add \r\n at the end of each line in the text to Replace with, then delete the EOLs.

    Several other editors accept direct copy and paste in the replace-with box, be it CR+LF, LF or combination of both. They are probably written in C++. But I think it can be done in any language since CR and LF have the same codes.\r\n\r\nDon is busy now with other issues in 7.4.1. I saw there are problems with replacing again in several open files.\r\n

  • @Helloiam-Thomas

    from the given sample you can use two simple regex to get the result.
    First, to get rid of the text encased by[ ]
    find what:


    and replace with nothing.
    To get rid of the numbers
    find what:


    and replace with nothing.
    If there are other numbers in your text which should be kept, that you might use


    and replace with



  • @Helloiam-Thomas

    The easiest way, without regex:

    1. Select the bloc you wanna replace and press Ctrl+H. Npp fills the Find what box automatically, with the proper codes inserted (although invisible, unless you try Find in files first; the results panel will show the Find string with the \r\n codes inserted properly).

    2. Select the text to Replace with. Unfortunately, Notepad++ does NOT fill the box with the proper codes automatically. You need insert the \r\n codes at the end of each line manually.

    some text**\r\n**
    some other text**\r\n**
    (Value 1<)\r\n

    Go to the end of each line and press Delete (it deletes the EOL codes, LF or CRLF).

    1. It is a one line bloc now. Select the new bloc of text and paste it into the Replace with box:

    some text**\r\nsome other text\r\nComments\r\nComments\r\n****\r\n***(Value 1<)*\r\n


Log in to reply