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
  • 698,132
  • 130
  • 858
  • 1,229

1 Answers1

1

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
  • 561,645
  • 34
  • 376
  • 476