You need to escape the angle brackets in a text, but some HTML tags need to be left, for example
Wait, how do you write an extensible regular? For example, you only need to exclude
, if you need to exclude more than one HTML tag directly on the pattern to add a group on it? (confusing text is not appropriate for parsing with HTML)
There's something on the internet that ]+>
doesn't look right
Or is there a corresponding function or method recommendation?
Reply content:
You need to escape the angle brackets in a text, but some HTML tags need to be left, for example
Wait, how do you write an extensible regular? For example, you only need to exclude
, if you need to exclude more than one HTML tag directly on the pattern to add a group on it? (confusing text is not appropriate for parsing with HTML)
There's something on the internet that ]+>
doesn't look right
Or is there a corresponding function or method recommendation?
Preg_replace ("/< (br|p) \") >/i "," & L t;$1& G T; ", $STR);
You can use the Strip_tags function that comes with PHP
http://php.net/manual/zh/function.strip-tags.php
< (?! BR|P) .*?>
May be the meaning, pure is more troublesome, can write program processing