How to Add Text at Start and End of Every Line in VS Code

Jul 04, 2021 · Article · 1 min, 259 words

Hello artisans, sometimes we need to enter text/code at the start and end of every line. We can do it easily with Visual Studio Code. I’m testing on Windows 10.

Table of Contents

  1. Problem
  2. Solution


I’m taking a text file. We are going to insert text at the start and end of every line.


Open the file and type CTRL + H. In the search bar, type ^(.+)$ and press the regular expression button:

In the replace field, write your desired text/code before and after $1. Let’s take a look at an example. We are going to add START:: text at the start and ::END text at the end of every line:

We’re done. You can see the output.

That’s it. Thanks for reading. 🙂


No comments yet…