Developer Tool
Extract HTML Tags
Extract HTML Tags pulls matching values out of mixed content and returns a clean list. Use it online on EasyTools99.
Tool area
Everything runs in the browser.
Reference results
| Input | Result |
|---|---|
<h2>Schedule</h2><h3>Morning</h3> | <h2>
</h2>
<h3>
</h3> |
<a href="/rooms">Rooms</a><a href="/hours">Hours</a> | <a href="/rooms">
</a>
<a href="/hours"> |
<p>Two</p><p>lines</p> | <p>
</p> |
<P>Upper</P><p>Lower</p> | <P>
</P>
<p>
</p> |
<!-- <span>Draft</span> --><p>Published</p> | <span>
</span>
<p>
</p> |
<span title="a > b">Compare</span> | <span title="a >
</span> |
How it works
The extractor looks for a tag name after an opening angle bracket, allowing a slash for closing tags. It outputs the whole matched string, which can include attributes. Exact duplicate strings appear only once and keep their first-seen order. A greater-than sign inside a quoted attribute can end the match early.
Using the result
For a code review, paste only the relevant fragment and keep the original markup open. Look at the attributes to distinguish similarly named tags, then inspect the rendered page to check nesting or accessibility semantics if the review depends on them.
Worked examples
- An editor inspects a venue listing to check its heading levels. She uses the tag list as a quick index and returns to the source if she needs the number of occurrences.
- A developer compares two links with different destinations. Their opening tags remain distinct because the attributes differ; an identical closing tag appears just once.
- A trainer tests an attribute containing the text “a > b”. The truncated match gives the class a concrete reason to inspect the parsed page for a definitive answer.
Common mistakes
- Reading the list as a full document tree.
- Using deduplicated output to estimate how often a tag occurs.
- Assuming the extraction sanitises a pasted fragment.
FAQ
Are closing tags included?
Yes. An opening tag and its closing form are separate matches.
Why is a tag inside a comment visible?
The search recognises tag-shaped text even in contexts where a browser would treat it as plain text.
Does case affect deduplication?
It uses exact strings, so an upper-case P tag and a lower-case p tag are retained separately.
