1

I'm trying to append some text to multiple files. Is this possible in VS-Code with Edit->"Replace in Files" using regex?

enter image description here

\z (only the end of text) is not working here - invalid regular expression.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

2

You may match the end of line that has no character immediately to the right:

$(?![\w\W])

Here, $ matches an end of line position and (?![\w\W]) is a negative lookahead that fails the match if any char appears immediately to the right of that location.

See the regex demo where m flag is enabled and makes $ match end of line positions, as in Visual Studio Code, and due to (?![\w\W]) it only matches at the very end of the text.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563