Notepad++: Remove new line and add comma

In Notepad Plus Plus, when you have a list of strings and you want to have one line with these strings separated by a comma, you can use the Replace function.

Let’s assume you have this list

Apple
Orange
Strawberry
Banana
Kiwi

and you want this outcome:

Apple, Orange, Strawberry, Banana, Kiwi

Then do this: CTRL + H to open the Replace window. Then select Regular Expression in Search Mode. In the Find What, enter [\r\n]+. Then in the Replace with, enter the comma (,) and maybe followed by a space if you also want to add that.

 

Author Bio

Thank you for your interest in my blog! On this miniblog, I write mostly short (technical) blog posts that might interest other people. Read more about me or feel free to contact me.

 

7 thoughts on “Notepad++: Remove new line and add comma

  1. Apple
    Orange
    Strawberry
    Banana
    Kiwi
    for above example follow these steps:
    1. replace \n by ‘
    2. replace \r by ‘
    3. replace ” by ‘,’
    4. give final single quote in first letter and last letter

Leave a Reply

Your email address will not be published. Required fields are marked *