[SOLVED] How Can I replace Files With Regex?

Issue

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.

Solution

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

Answered By – Jingmiao Xu-MSFT

Answer Checked By – Jay B. (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *