Reputation: 258
In my source code, using Visual Studio 2015 I want to replace all javascript calls from a specific folder to its minimized filename. For example:
<script type="text/javascript" src="~/Scripts/common/filename1.js"></script>
<script type="text/javascript" src="~/Scripts/common/filename2.js"></script>
<script type="text/javascript" src="~/Scripts/common/filename3.js"></script>
I want to replace with:
<script type="text/javascript" src="~/Scripts/common/filename1.min.js"></script>
<script type="text/javascript" src="~/Scripts/common/filename2.min.js"></script>
<script type="text/javascript" src="~/Scripts/common/filename3.min.js"></script>
I use the following expression:
What should I put in the "Replace with" field?
Upvotes: 1
Views: 1045
Reputation: 258
I found a answer following Matthew Strawbridge's suggestion and making a little correction. The find expression is:
(<script type="text/javascript" src="~/Scripts/common/.*)(\.js"></script>)
And the replacement expression is
$1.min$2
I've tested in my project and it worked fine.
Upvotes: 5
Reputation: 3549
Instead I would do this...
.js"></script>
and replace it with
.min.js"></script>
Sorry I keep changing this, but this leaves out the regex which is unnecessary
Upvotes: 0