Regex to search for a word in a string in Visual Studio

前端 未结 5 1462
梦毁少年i
梦毁少年i 2021-02-04 04:02

I need to search all of my codebase for \"Url\" and replace it with \"URL\". If I search for Url in Visual Studio I also get all my variables with \"Url\" in it.

Anyone

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-04 04:32

    I used the following to search only "whole words" (i mean: appearing with an space before an after or immedately after or before the " ):

    (("[^"]*[ ]|")Url([ ][^"]*"|"))
    

    For example this matches "test Url" and "Url test" but don't "testUrl".

提交回复
热议问题