Skip to content

Files

Latest commit

 

History

History
16 lines (12 loc) · 326 Bytes

stripHTMLTags.md

File metadata and controls

16 lines (12 loc) · 326 Bytes
title tags
stripHTMLTags
string,utility,regexp,beginner

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'