Pattern library/Strip HTML tags regex

Strip HTML tags regex

Replace matches with an empty string. Strip script/style blocks first on hostile pages. Not a sanitizer.

Expression

/<[^>]+>/g

How to read it

  • <[^>]+>Any tag

Sample test

6 match(es)
<p>Hello <em>world</em></p><div>Next</div>

Starter prompt: remove all HTML tags leave plain text