Home > OS >  Is it possible to replace all instance by using regex with VS code?
Is it possible to replace all instance by using regex with VS code?

Time:11-01

I have a json file. where i would like to update the umbers with quates(""). I am trying with regexp. but I am not able to get the result. some one can help me? is it possible or regex only for search purpose?

here is my try:

find: phoneId:\s\d replace: phoneId: '/phoneId:\s\d - not works

screenshot

CodePudding user response:

Using an online regex tester like RegExr can help constructing regular expressions like this. Like @derpirscher already commented, you have to define a capture group in your find regex using (...), which then can be referenced in your replace regex using $x with x starting from 1.

In your case this would be:

Find: phoneId: (\d )

Replace: phoneId: "$1"

  • Related