How to edit all lines in Visual Studio Code

You could edit and replace with a regex:

Find (Ctrl+F):

^(.+)$

Replace:

'$1'

This regex finds any content on a line and wraps it inside quotes. The $1 refers to whatever is matched inside the parentheses in the regex. In this case, it’s “one or more characters” i.e. everything on the line. Be sure to tick the regex icon.

Video demonstration of the replacement

If every line may or may not have a space before the content, and you want every line to have a space, try this:

Find:

^ ?(.+)$

Replace (notice the space before the first quote):

 '$1'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)