You need to escape the angle brackets in a piece of text, but some HTML labels need to be left, such as & amp; lt; br & amp; gt; & amp; lt; p & amp; how do I write an extensible regular expression? For example, you only need to exclude & amp; lt; br & amp; gt; & amp; lt; p & amp; gt ;, if you need to exclude one more HTML Tag directly on pattern, more... you need to escape the angle brackets in a piece of text, but some HTML labels need to be left, such
And so on. How do I write an extensible regular expression? For example, you only need to exclude
If you want to exclude one more HTML Tag, add one more group to the pattern tag? (The text is messy and cannot be parsed using HTML)
Find ]+>
It seems wrong.
Or are there recommended functions or methods?
Reply content:
You need to escape the angle brackets in a piece of text, but some HTML labels need to be left, such
And so on. How do I write an extensible regular expression? For example, you only need to exclude
If you want to exclude one more HTML Tag, add one more group to the pattern tag? (The text is messy and cannot be parsed using HTML)
Find ]+>
It seems wrong.
Or are there recommended functions or methods?
Preg_replace ("/<(br | p) \/?)> /I "," & l t; $1 & g t; ", $ str );
You can use the strip_tags function provided by php.
Http://php.net/manual/zh/function.strip-tags.php
<(?! Br | p). *?>
This may be the meaning. If it is pure, it is troublesome. You can write a program to process it.