Home > OS >  How Can I replace Files With Regex?
How Can I replace Files With Regex?

Time:02-27

I have an aspnet webform application and I have more than 1000 server.transfer like below

Server.Transfer("~/General/Personnel/List.aspx");

I want to add /V2 after "~" in all files. Expected is

Server.Transfer("~/V2/General/Personnel/List.aspx");

This is only sample so I have different folder structure like General/Users/Personnel, Customer/Personnel, Users/List/Personnel only /Personnel is common for every server transfer I want to add /V2 after "~" in all files which contains "/Personnel". How Can I do this with regex or another else in visual studio.

CodePudding user response:

If you want to add “/V2” before all files containing /Personnel, you can try this regex to replace them.

You can click Ctrl Shift F to open this window and replace ~/(.*)/Personnel into ~/V2/$1/Personnel enter image description here

  • Related