There are some special needs. An expression is needed to extract N field data in html
For example
<p class="test">
<p class="title">xxx</p>
<p class="xas"></p><pclass="asd"></p>
<p class="pic">xxx</p>
</p>
<p class="test">
<p class="title">xxx</p>
<p class="xas"></p><pclass="asd"></p>
<p class="pic">xxx</p>
</p>
We need to extract the title and pic data from HTML. How to write the regular expression?
The <p class="xas"></p><pclass="asd"></p> in the middle is different content, but this content is useless and there is no need to crawl it
I'm just getting started. Please give me some advice. Thank you
You don’t have to use regular expressions, there is something called phpquery
The result is:
Supplement:
I didn’t see clearly that the question mentioned PHP. I don’t know much about PHP. It’s written in js. You can just take the regular part.
Just upload the code
This kind of performance is very poor -.-. It is still reliable to use js to obtain it at the front desk.