Sublime Add text at start and end of each line

Sublime Editor is an excellent tool for managing text files across all operating systems. It allows for efficient modifications to text files. As a programmer, there are instances when I need to prepend or append specific text to each line in a text file (such as adding single or double quotes at both ends of each line)

Sublime Regular Expression
Sublime Regular Expression
Steps :
  1. Launch the file in Sublime Text.
  2. Press Ctrl + F on Windows / Command + F on macOS.
  3. In the Find Options at the bottom, select the .* (Regular Expression) button.
  4. To add text at the start of each line, search for ^ (caret symbol) and click on Find All: the cursor will blink at the beginning of each line, allowing you to type the text that will be added at the start of each line.
  5. To append text at the end of each line, search for $ (dollar sign).
  6. That's it!

Note: Ensure that the Regular Expression option is selected; otherwise, this operation will not work.

Example: Below is a file containing some text where double quotes need to be added at the start and end of each line. A .gif image demonstration is provided to illustrate how to accomplish this using the steps above.

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


Frequently Asked Questions

What is Sublime Editor?

Sublime Editor is an excellent tool for managing text files across all operating systems.

How can I modify text files in Sublime Editor?

You can prepend or append specific text to each line using regular expressions.

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!