【问题标题】:What regular expression can I use to replace @Url.Content("~/path/to/resource") with "~/path/to/resource"我可以使用什么正则表达式将 @Url.Content("~/path/to/resource") 替换为 "~/path/to/resource"
【发布时间】:2012-10-29 17:19:48
【问题描述】:

我已经将另一个 MVC 3 项目升级到 MVC 4,我已经厌倦了用它们的 @Url.Content()-less 值替换 <link> href 和 <script> src 值。 (MVC 4 Razor 2 将自动解析任何以~/ 开头的值的内容路径。

我可以在 Visual Studio 中使用什么正则表达式来一次全部替换它们?

【问题讨论】:

    标签: visual-studio razor asp.net-mvc-4


    【解决方案1】:

    查找内容:

    "\@Url\.Content\({:q}\)"

    替换为:

    \1

    确保选中使用并选择正则表达式

    【讨论】:

      猜你喜欢
      • 2019-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-16
      • 1970-01-01
      • 1970-01-01
      • 2012-07-25
      • 1970-01-01
      相关资源
      最近更新 更多