Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 608 Bytes

stripHTMLTags.md

File metadata and controls

20 lines (15 loc) · 608 Bytes
title tags
stripHTMLTags
string,regexp,beginner

TS JS Deno

Removes HTML/XML tags from string.

Use a regular expression to remove HTML/XML tags from a string.

const stripHTMLTags = (str) => str.replace(/<[^>]*>/g, "");
stripHTMLTags("<p><em>lorem</em> <strong>ipsum</strong></p>"); // 'lorem ipsum'