Finding an XML Tag
<[a-z:_][-a-z0-9._:]+((\s+[^>]+)*|/s*)/?>
Example:
Finding an HTML Attribute
(?:<[^>\s]+)(\s+[a-z]+(-[a-z]+)?(=(""[^<&""]*""|'[^<&']*'|[^<>\s]+))?)+
Example:
Removing an HTML Attribute
(<[^"">]+|<[^>""]+(""[^""]*""[^""]*)*)\sstyle=(""[^<&""]*""|'[^<&']*')?
Example:
Adding an HTML Attribute
(<h2)(?![^>]*\sclass=""[^<&""]*"")
$1 class="c1"
Example:
Removing Whitespace from HTML
(?:(?<=<)|(?<=</))([^/>]+)(?:\sstyle=['""][^'""]+?['""])([^/>]*)(?=/?>|\s)
$1$2
Example:
Removing Whitespace from CSS
(?<=[:;\w{])\s+(?=[}\w;:])
Example:
Finding Matching <script> Tags
<[a-z:_][-a-z0-9._:]+((\s+[^>]+)*|/s*)/?>
Example: