Visual Studio - How to replace a text file

Using the search and replace dialog in Visual Studio (2010), you can replace any text, but save the text of the replaced text.

T. I want to change "foo" to "bar", but in my code there are Foo, foo and FOO. I want the replacement to be Bar, bar, BAR, respectively.

Is it possible? I suspect that I need to use regular expression functionality, but I need help with this.

EDIT . I know that I can establish a match option, but all that does this is the restriction on replacing text that matches the case of a search query. This is how I do it at the moment, but it is tiring to have three replacements: foo, Foo, and FOO

+8
editor visual-studio-2010 ide
source share
2 answers

It is just to expand the Find Options of the Find and Replace dialog box Find and Replace check the Match Case checkbox.

Detailed dialogue documentation can be found here :

Match Case — Displays only instances of the search string that match both content and individually. For example, a search for “MyObject” with the selected match returns “MyObject”, but not “myobject” or “MYOBJECT.”


Edit: (after clarification)

I do not know an easy way to do what you want. RegEx may have been created that does this, but I suspect that in this case the search and replace will be faster, easier, and less error prone than RegEx.

+4
source share

I think if you use "match case" = true, you can replace "Foo" with "Bar" and "foo" with "bar"

+1
source share

Source: https://habr.com/ru/post/649864/


All Articles