Notepad++ RegEx Search/Replace: How to append and prepend a character at start and end of each file line?

20,194

Solution 1

Just search for

(.*)

and replace with

"\1"

with regular expression option activated. Regular expressions are working only on a row bases, so (.*) matches the complete row and because of the brackets around you can access the match using \1.

Solution 2

Try searching ^(.*)$ and replacing by "$1".

bye ;)

Share:
20,194
Admin
Author by

Admin

Updated on August 18, 2020

Comments

  • Admin
    Admin over 3 years

    How to append and prepend a character at start and end of each file line?

    I have this file structure:

    140","Bosnia
    160","Croatia
    170","Serbia
    180","Montenegro
    200","Slovenia
    

    What I need is to add a double quote " at the start and at the end of each file line, using regular expressions in Notepad++ editor.

    Thanks!

  • stema
    stema over 12 years
    It has to be a \1 in Notepad++, the $1 is inserted literally.