Regex for ASP.Net multi-line comment search

enter image description hereI have the following code. In Visual studio, you can find the regular expression and replace it. therefore, I cannot generate a regular expression for this code. Can anybody help me?

<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>

The regular expression needed to find content between <% - content -%>

+4
source share
1 answer

Here is a regex that you can use (note the use of a *?lazy quantifier so as not to overload):

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

Tested in Visual Studio 2012 :

enter image description here

+5
source

All Articles