0

According to this StackOverflow post, accompanied by a link to a GitHub PR that has been merged and the version has been released, users should be able to replace the results in global find to lower case using Regex. However, this feature is not working for me, and I am using a much later version of VS Code (1.77.3) than this was released for (1.47).

You can see that "HI" is replaced with "\LHI".

Can someone please explain how to replace to lowercase? Note that I am not looking to use "Transform to Lowercase" command from the command palette, as that does not perform mass replace.

enter image description here

starball
  • 20,030
  • 7
  • 43
  • 238
Colonel_Old
  • 852
  • 9
  • 15

1 Answers1

1

That kind of a replacement, using \L$0 doesn't work in the Search replace. You could just wrap the whole thing in a capture group like

(\b(?:HI|HELLO)\b(?![A_Za-z]))

and then replace with \L$1 and it works as you expect. $0 does work in the replace field just not together with \L, \U, \l or \u.

Mark
  • 143,421
  • 24
  • 428
  • 436