Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a string to the end of each line in VS Code using regex?

People also ask

How do you write regex in Visual Studio code search?

Vscode has a nice feature when using the search tool, it can search using regular expressions. You can click cmd+f (on a Mac, or ctrl+f on windows) to open the search tool, and then click cmd+option+r to enable regex search. Using this, you can find duplicate consecutive words easily in any document.

What regex does VSCode use?

Visual Studio uses . NET regular expressions to find and replace text.


This patter does work on my VS Code but only on lines that actually contain something. Empty lines stay empty.

Find: ^(.*)$
Replace: $0 Donkey


The easiest way to do it is like this:

Find: .$
Replace: $&Donkey


You can use:

$ = end of line ^ = begin of line