RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
<(?i)(?=.[^>]*runat=["]?server)(?<TYPE>\S[^>\s]+).[^>]*id=["]?(?<NAME>\w+).[^>]*>
Description
This regular expression finds all opening tags that have the runat='server' attribute specified. It groups the type of the control (eg. asp:Label) in to a group named TYPE and the id of the control into a group named NAME. It is useful for finding all server tags or controls in an ASPX (ASP.NET) page.
Matches
<asp:Label id="Label1" runat=server> | <TABLE id="tblTable" runat=serve
Non-Matches
<table class="tableclass"> | <asp:Label id="Label2">
Author Rating: The rating for this expression. Shane O'Grady
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Thank you!
Name: A satisfied reader
Date: 5/3/2012 2:17:08 PM
Comment:
Thank you very much! I had to replace the xml escape sequences to use in .NET, after that, it worked out great. I needed to have the ID and tag type available to me. You saved me hours of work!


Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials