Regular Expressions to strip HTML tags - - regular expression strip tags


html - Regex select all text between tags - Stack Overflow regular expression strip tags

Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

9 regular expressions to strip HTML tags. All the regex examples can be tested in an online javascript regular expression tester.

Anything between the tags is captured into the first backreference. The question mark in the regex makes the star lazy, to make sure it stops before the first closing tag rather than before the last, like a greedy star would do. This regex will not properly match tags nested inside themselves, like in TAG>oneTAG>twoTAG>oneTAG>.

Regular Expression to. Toggle navigation. RegEx Testing From Dan's Tools. Web Dev. HTML/JS/CSS Playground; Strip HTML tags. Comments. Post Posting Guidelines Formatting - Now. Top Regular Expressions. pdf or jpg Regex Tester isn't optimized for mobile devices yet. You can still take a look, but it might be a bit quirky.