How to use php regularization to remove redundant tags
This article focuses on "how to use php regularization to remove redundant tags". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to use php regularization to remove redundant tags"!
1. Regular removal of php
Space
$str='
Factory Supply High Quality Maitake Mushroom Extract Powder Bulk
Product Name
'; $uuu=preg_replace ("/ (\ s |\ & nbsp\; | |\ xc2\ xa0) /", ", $str); echo str_replace ('
',', $uuu)
2. How to use the str_replace function of php
And replace it?
$html= "
Fdasf
; echo $string = str_replace (array ("
","
"),", $html); if br is
Content
Replace with
Content
Content
Replace with
Contend
(it is possible for spaces to be mixed by tab and space keys) the method is as follows: $html=preg_replace ('/ [\ n\ r\ t] /',', $html); / / remove spaces if
Followed by several, and then the content.
Content
Replace with
Content
Content
Replace with
Contend
Str_replace ("
",", $htmlstr)
3. The regular expression replaces or removes the
Label
Such as: Zhang San
Aaaa
History
Bbbb
If you want to replace
Aaaa
, including the content, put
[^ / gi,'') alert (s)
5. See here the editor specially shares a replacement rule for you. The empty characters basically include all of them.
Str=str.replace (/
(\ s |\ & nbsp\; |\ xc2\ xa0) * / ig, "")
For
、
P >
All can be matched.
At this point, I believe you have a deeper understanding of "how to use php regularization to remove redundant tags". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!