I’m using the Find and Replace dialog in Visual Studio 2010. I don’t have a problem getting results to match the find criteria. The problem is, the result after the find / replace operation concludes is an * in the string. Visual Studio is treating the asterisk as a literal character and places * in the result. Not what I need and not all that useful.
I’m using this for the Find criteria:
@Html.TextBoxFor(*)
I’m using this for the Replace criteria:
@Html.TextBoxFor(*, new { @class = "className" })
If this is my starting string,
@Html.TextBoxFor( x => x.price)
I want the result to be
@Html.TextBoxFor( x => x.price, new { @class = "className" })
not this
@Html.TextBoxFor(*, new { @class = "className" })
How do I perform a find with a wildcard (*) but not replace the match with a literal * ?
Select “use Regular Expressions”.
Find
\@Html\.TextBoxFor\({.*}\)Replace with
@Html.TextBoxFor(\1, new { @class = "className" })