-3

I have script tags everywhere in CSHML files. Something like below

<script src="~/Areas/Users/Somefilename.js"></script>

Using the regular expression i want to replace it using Visual Studio 2017 find and replace with the following

 @Scripts.Render("~/Areas/Users/Somefilename.js")

The path parameter remains the same.

So based on the SO post

In find box i put <script src=.*></script>
and in replace box i put @Scripts.Render($1)

it finds the line in cshtml but replace does not work. It actually puts $1 instead of the path. @Scripts.Render($1)

LP13
  • 25,900
  • 45
  • 172
  • 339

1 Answers1

2

Just wrap you .* in brackets like this (.*). This will capture the value and enable the replacement.

dnickless
  • 10,110
  • 1
  • 15
  • 31