Find and Replace in Visual Studio using Regex -


i found out can use regex search queries in find , replace in visual studio. have lot of similar lines so:

datum["id"] = id; datum["name"] = name;

i have more lines so:

this.id = datum["id"]; this.name = datum["name"];

i want turn first lines to:

datum.set("id", id); datum.set("name", name);

and second set of lines to:

this.id = datum.get<int>("id"); this.name = datum.get<int>("name");

how possible find , replace , regex? can't figure out.

after enabling regular expression clicking on 'use regular expression' button, place following in find:

datum\[\"id\"\]\s*=\s*id\;

and place following in replace (no need use regex in replace):

datum.set("id", id); 

similarly:

in find:

datum\[\"name\"\]\s*=\s*name\;   

in replace:

datum.set("name", name); 

in find:

this\.id\s*=\s*datum\[\"id\"\]\;  

in replace:

this.id = datum.get<int>("id"); 

in find:

this\.name\s*=\s*datum\[\"name\"\]\;  

in replace:

this.name = datum.get<int>("name"); 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -