Home >Backend Development >PHP Tutorial >How to match all

and all tags on the page using regular expressions?

How to match all

and all tags on the page using regular expressions?

WBOY
WBOYOriginal
2016-12-01 01:28:011804browse

How to match all

and all tags on the page with regular expressions?

How to write this regular expression?

Reply content:

How to match all

and all tags on the page with regular expressions?

How to write this regular expression?

<code>/<p(\s[^>]*)?>.*?</p>|<img\s[^>]+>/gis</code>

/<p>[^<]*?</p>|<img [^]*?/>/giIf there is nesting, it cannot be processed.

/<p>.*</p>|<img.+>/gi

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Array regroupingNext article:Array regrouping