Notepad++ add to every line
Here is my answer. To add ');' to the end of each line I do 'Find What: $' and 'Replace with: \);' you need to do escape;
Notepad++ has a very powerful editing capability. (Today I'm searching for the similar function in Sublime Text), but for Notepad++, just hold Alt when you drag the mouse. What you type will then replace the selected column on every line. To insert without replacing existing text, use Alt-Shift.
Follow these steps:
- Press Ctrl+H to bring up the Find/Replace Dialog.
- Choose the
Regular expression
option near the bottom of the dialog.
To add a word, such as test
, at the beginning of each line:
- Type
^
in theFind what
textbox- Type
test
in theReplace with
textbox- Place cursor in the first line of the file to ensure all lines are affected
- Click
Replace All
button
To add a word, such as test
, at the end of each line:
- Type
$
in theFind what
textbox- Type
test
in theReplace with
textbox- Place cursor in the first line of the file to ensure all lines are affected
- Click
Replace All
button
- Move your cursor to the start of the first line
- Hold down Alt + Shift and use the cursor down key to extend the selection to the end of the block
This allows you to type on every line simultaneously.
I found the solution above here.
I think this is much easier than using regex.