I am using Visual Studio and I want to Find/Replace spaces with underscores in one of my classes.
However I am coding in C# and when using the standard Find/Replace dialogue box like so:

It also Finds and Replaces all of my whitespace, which I don’t want.
Is there a way to perform a Find/Replace only inside strings?
Thanks
You can use the Visual Studio regular expression flavour – click the
Usecheckbox and selectRegular expressionsin the drop down.Something like the following should work (it will match a string containing only whitespace and place the whitespaces in a capturing group):