Community Patterns

Community Library Entry

3

Regular Expression
Created·2024-10-08 14:04
Flavor·PCRE2 (PHP)

/
<?[^<>]*>|<[^>]*
/
g
Open regex in editor

Description

Strip all HTML tags from a string. HTML tags are enclosed in < and >.

The regex will be applied on a line-by-line basis, meaning partial tags will need to be handled by the regex. Don't worry about opening or closing tags; we just want to get rid of them all.

Note: This task is meant to be a learning exercise, and not necessarily the best way to parse HTML

Submitted by anonymous