c# - 用于查找 ASP.Net 页面多行注释的正则表达式

标签 c# asp.net regex

enter image description here我有以下代码。在 Visual Studio 中,可以使用正则表达式查找并替换。所以我无法为此代码生成正则表达式。谁能帮帮我?

<div class="span2 control-group">
    <%--<asp:Label ID="lblTeamName" Text="Team" runat="server" CssClass="control-label bold"></asp:Label>--%>
    <div class="controls">
        <%--<telerik:RadComboBox ID="rcbTeam" EmptyMessage="Select" runat="server" Width="160px"
            OnSelectedIndexChanged="rcbTeam_SelectedIndexChanged" AutoPostBack="true">
        </telerik:RadComboBox>--%>
        <asp:RequiredFieldValidator ID="RF2" runat="server" ErrorMessage="*" Display="Dynamic" Font-Size="X-Large"
            SetFocusOnError="True" ValidationGroup="ChartValidate1" ForeColor="red" ControlToValidate="rcbTeam"></asp:RequiredFieldValidator>
    </div>
</div>

查找 <%--content--%> 之间的内容需要正则表达式

最佳答案

这是您可以使用的正则表达式(请注意 *? 惰性量词的使用,以免过度匹配):

<%--[\r\n\s\S]*?--%>

在 Visual Studio 2012 中测试:

enter image description here

关于c# - 用于查找 ASP.Net 页面多行注释的正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29692068/

相关文章:

c# - 在 ASP.net MVC Web 应用程序中设置 Azure KeyVault

c# - mvc Controller 类,通过用户单击按钮自动将新数据添加到模型中

c# - 带参数的 ASP.NET ODBC 查询

c# - 使用 lambda ID(distinct) 和特定 ID 的计数从列表中返回 2 个属性?

java - 使用正则表达式屏蔽信用卡号

c# - 用于 ASP.Net 中不同版本 Excel 的连接字符串

c# - 这在 C# 中究竟意味着什么?

c# - EF Core - 不要在查询中包含导航属性

c# - 使用正则表达式匹配字符串 c#

Python 正则表达式困难