Sublime is one of the most used code editor by the developers. It is famous because of its packages & other great features. It keeps up working to make it better.

I cam across the condition where I had thousands of line and had to put certain text at the start & end of the each line. I decided to research instead doing manual, luckily this resolves the issue.

We must enable Regular expressions for this. Please follow the following steps to do so.

Steps:

  1. Ctrl + H for the search & replace option
  2. Select in the code section, Ctrl+A for selecting all
  3. Press Ctrl+Shift+L lets you to select at the end of the cursor for all the selections
  4. Enable regular expression in search & replace section
  5. After this follow below steps for the inserting in the start & end

Insert in the start of each line

  • Replace ^ with your text. For example: if you are adding ” in each line start, place ^ in find & keep ” in the replace.
  • Then Press replace all. BOOM! you will be happy.

Insert in the end of each line

  • Replace $ with the text or anything you will like to put at the end of each line.
  • Keep $ in find & your text (eg: * ) in the replace field. Then press, replace all. You will surprised that you will reduce your manual work pretty much.