How Does Instant HTML Markup Removal Work?
The HTML stripper applies text.replace(/<[^>]+>/g, "") across the entire string, deleting every angle-bracketed element (<div>, <a href="...">, <span style="...">) and leaving only the visible text nodes.
When you copy rich text from web pages or CMS editors, raw HTML tags frequently pollute the clipboard. The HTML transform removes all tags (<p>, <b>, <div>, etc.) while preserving the inner text content.
What Regex Rule & Worked Before / After Example Does Strip HTML Use?
Every tag matching /<[^>]+>/g is removed in a single client-side pass without executing embedded scripts or loading external resources:
- Worked Before / After Example: Input
<div class="content"><h1>Article Title</h1><p>This is <strong>formatted</strong> text with <a href="#">links</a>.</p></div>(123 characters, 10 HTML tags) → OutputArticle TitleThis is formatted text with links.(47 characters, 0 HTML tags, 76 markup characters stripped).
| HTML Element Type & Pattern | Input Example (Before) | Output Result (After) | Tags / Chars Stripped (count) |
|---|---|---|---|
Inline Formatting (<strong>, <em>, <span>) |
This is <strong>bold</strong> text. (35 chars) |
This is bold text. (18 chars) |
2 tags removed (-17 chars) |
Anchor Links with Attributes (<a href="...">) |
Visit <a href="https://acme.com">Acme</a> (41 chars) |
Visit Acme (10 chars) |
2 tags removed (-31 chars) |
Block Wrappers (<div class="...">, <p>) |
<div class="box"><p>Clean copy</p></div> (40 chars) |
Clean copy (10 chars) |
4 tags removed (-30 chars) |
Self-Closing & Void Tags (<br/>, <img .../>) |
Line 1<br/>Line 2<hr> (21 chars) |
Line 1Line 2 (12 chars) |
2 void tags removed (-9 chars) |