Add Text at Start and End of Each Line Notepad++


Notepad++ is a very useful text editor for every programmer, sadly its not yet available on the Mac OSX,

If you are in a situation where you want to put some text at the start of each line in your text, or at the end of each line , or both , well you can achieve this in notepad++ using the Find and Replace option using Regular Expression.

Check out how you can do it,

Step 1: Open Your text in Notepad++

Insert text at the beginning and end of each line notepad++
Insert text at the beginning and end of each line notepad++

Step 2: To add Text at the Start of each line

Press Ctrl+F to open Find window, click on the Replace tab, check that you have selected Regular Expression option, now add ^ in the Find textbox and the text you want at the start of each line in the Replace textbox, and click Replace all.

Find and Replace notpad++ to insert text at start.jpg
Find and Replace notpad++ to insert text at start.jpg

Step 3: To add Text at the End of each line

Press Ctrl+F to open Find window, click on the Replace tab, check that you have selected Regular Expression option, now add $ in the Find textbox and the text you want at the End of each line in the Replace textbox, and click Replace all.

Find and Replace notpad++ to insert text at end.jpg
Find and Replace notpad++ to insert text at end.jpg

Step 4: Result: You should now be able to see the changes.

Result notepad++.jpg
Result notepad++.jpg

Important: Do not forget to enable "Regular Expression" radio box, if you do not do so, you would not get the results!

Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.