Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
(?<TAG>\s*<(?<TAG_NAME>\w*)\s+(?<PARAMETERS>(?<PARAMETER>(?<PARAMETER_NAME>\w*)(=["']?)(?<VALUE>[\w\W\d]*?)["']?)+)\s*/?>) |
Description |
Parse html tags to extract tag names and parameters with parameter name/value pairs. |
Matches |
<td valign="top" align="left" colspan="2"> |
Non-Matches |
<!--dynamic_content GlobalID=49113--> |
Author |
Rating:
Maxim Paukov
|
Title |
Test
Details
Find <h1> Tags
|
Expression |
<h([1-6])>([^<]*)</h([1-6])> |
Description |
This regex find valid <h1-6> html tags |
Matches |
<h2>test2</h2><h3>test3</h3> |
Non-Matches |
<h>test1</h> |
Author |
Rating:
Syrprize
|
Title |
Test
Details
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:
John Smith
|
Title |
Test
Details
HTML Tags and Comments
|
Expression |
<!*[^<>]*> |
Description |
Mathes any HTML tag with any parameters and HTML Comments. Very useful to clean HTML of a text. |
Matches |
<tr style="height: 1px; background-color: #ffffff"> <td colspan="4"> <!-- comment --> <!DOCTYPE html PUBLIC ... > |
Non-Matches |
Any other text outside a tag symbols < > |
Author |
Rating:
Roberto Santana
|
Title |
Test
Details
Remove all attributes related to event handling from inside HTML tags
|
Expression |
(\s(\bon[a-zA-Z][a-z]+)\s?\=\s?[\'\"]?(javascript\:)?[\w\(\),\' ]*;?[\'\"]?)+ |
Description |
No idea whether anyone would ever need this, but I had to work half a day on this pattern, so I decided to share it. :) It was never meant for productive use at all; it was rather to filter out all that annoying event handling stuff to find a bug in my DHTML table-generating script. Give it a try with this string (see details):
<div id="TSelect_TD_value_911" class="TSel" onpaste="" onblur="TSelectClose(this);" onClick="TSelectOpen(this);" style="width:250px; padding:2px;"> |
Matches |
onPaste onBlur onClick ... ; onblur onclick onpaste ... |
Non-Matches |
<div id="TSelect_TD_value_911" class="TSel" style="width:250px; padding:2px;"> |
Author |
Rating:
globalplayer
|
Title |
Test
Details
Strip HTML tags with exceptions
|
Expression |
<\/*?(?![^>]*?\b(?:a|img)\b)[^>]*?> |
Description |
This regex will match all HTML tags except 'a' tags or 'img' tags. You can edit the list of exclusions as you see fit. I use this regex to strip all HTML tags from source data except anchor tags and image tags. |
Matches |
<script> </html> <anytag> |
Non-Matches |
<a> <img /> </a> |
Author |
Rating:
Charles Forsyth
|
Displaying page
of
pages;
Items to