Sublime Add text at start and end of each line

Sublime Editor rocks when it comes to handling Text files on any Operating systems you work on. You can make changes to text files much effectively using this tool. As a programmer there are times when i want to add certain text at the start and end of each line in a text file (like adding single or double quotes at both ends of each line)

Sublime Regular Expression
Sublime Regular Expression
Steps :
  1. Open the file using Sublime Text.
  2. Press Ctrl + F Key on Windows / Command + F on Mac OS X.
  3. Now you would see Find Options at the bottom, Select .* (Regular Expression) Button
  4. Now Search : ^ (Exponent Symbol) and Click on Find all: You would see the cursor's blinking at the start of each line of the file, anything you type now will added at the start of each line.
  5. Similarly to add some text at the end of each line, Search : $ (Dollar)
  6. Thats it!

Note: Do check that the Regular expression option has been selected, if it is not you will not be able to perform this operation.

Example: Here is a file with some text, double quotes are to be added at the start and end of each line, below is a .gif image demonstration of how to achieve this using the above steps.

Sublime Add Text at Start and End of Each Line
Sublime Add Text at Start and End of Each Line

Recent Posts:

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, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.