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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Match Valid HTML Tags
Expression
</?(a|abbr|acronym|address|applet|area|b|base|basefont|bdo|big|blockquote|body|br|button|caption|center|cite|code|col|colgroup|dd|del|dir|div|dfn|dl|dt|em|fieldset|font|form|frame|frameset|h[1-6]|head|hr|html|i|iframe|img|input|ins|isindex|kbd|label|legend|li|link|map|menu|meta|noframes|noscript|object|ol|optgroup|option|p|param|pre|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|ul|var|xmp)\b((\"[^\"]*\"|\'[^\']*\')*|[^\"\'>])*>
Description
This is very similar to my other expression, except it only matches tags that a browser would read, so if you have an extra " in the tag, it will not count it, and move onto the next possibility.
Matches
</a> <h2 > </a asdfs> </h2 asfsdf> <a href="abc>>123">
Non-Matches
< /a> </h 2 asfsdf> <ahref="abc"123">
Author Rating: The rating for this expression. John Smith
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: Close Tabs
Name: Dustin Sweigart
Date: 5/24/2007 9:35:03 PM
Comment:
Are you trying to JUST get the closing and self closing tabs? I'll work on something and see if I can get it posted this weekend.


Title: Close tabs
Name: Rodrigo Polo
Date: 4/19/2007 4:40:10 PM
Comment:
how can I get all closing and self closing tabs... like: </a> <img src='' /> </p> <br />


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