Skip to content

Files

Latest commit

fc72dee · Jan 26, 2018

History

History
13 lines (9 loc) · 279 Bytes

stripHTMLTags.md

File metadata and controls

13 lines (9 loc) · 279 Bytes

stripHTMLTags

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'