Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ - how to add character to beginning of line

I'm trying to add parenthesis to beginning and end of line in Notepad++. Using sed I would do:

   sed -i 's/^/(/' filename
   sed -i 's/$/)/' filename

and be done, but I have to use Notepad ++ on Windows. I went to find and replace, chose regular expressions and tried to replace "^" with "(", but I got "zero length match" and it doesn't add the character (same with replacing "$" with ")").

What am I doing wrong?

like image 566
Tensigh Avatar asked Aug 05 '14 07:08

Tensigh


2 Answers

Sorry, found the answer right after I posted the question. In case anyone is curious, in Notepad++ you have to escape the parenthesis characters whereas you don't have to in sed.

In Notepad++, under "Replace with", choose:

  \(

and it will work.

like image 98
Tensigh Avatar answered Oct 04 '22 14:10

Tensigh


In the search field put ^(.*)$ and in the replace field \(\1\). This worked just fine for me.

like image 20
rinukkusu Avatar answered Oct 04 '22 14:10

rinukkusu