Delete a line in file based on search criteria / R

2019-09-20 10:49发布

I have a .csproj file which has entries like:

<Content Include="somepath1\somedir2\dir3\Thumbs.db" /> 

<Content Include="newpath\somedir2\Thumbs.db" /> 

<Content Include="anotherpath\somedir1\dir3\dir4\Thumbs.db" />

They are scattered all over the file.

What I am looking for is to use Visual Studio(Preferred) or other tool to delete the entire line by Search/Replace.

1条回答
混吃等死
2楼-- · 2019-09-20 11:03

If you want to remove all the content include, you can use a simple regex like this:

<Content Include=.*?\/>

On the other hand, if you want to remove the thumbs then you can use

<Content Include=".*?Thumbs.db.*?\/>

Working demo

查看更多
登录 后发表回答