Could you tell me if I can use regular expressions to make it impossible?

Source: Internet
Author: User
Could you tell me if I can use regular expressions to match my life or death? a page has many Weibo posts and a microblog contains many layers of divs. I want to get the two divs in each microblog. data:

Text content







The two divs are of the same level.
I want to catch the content in class = content and the src of img;
Note that the second DIV is not necessary. some Weibo posts have images and some do not have them.


Reply to discussion (solution)

We recommend that you use phpquery. it's pretty good to have a look at it two days ago... you don't need to think about those regular expressions after you have mastered the method.

We recommend that you use phpquery. it's pretty good to have a look at it two days ago... you don't need to think about those regular expressions after you have mastered the method.
Thank you, moderator.
There are two other questions that I choose to use. content to capture the content, it will display all the class content on the entire page as a content, so there is no way to tell where it is a content.
Another is how to make it read the next page.
The younger brother asks the yellow moderator to give me some advice.


We recommend that you use phpquery. it's pretty good to have a look at it two days ago... you don't need to think about those regular expressions after you have mastered the method.
Thank you, moderator.
There are two other questions that I choose to use. content to capture the content, it will display all the class content on the entire page as a content, so there is no way to tell where it is a content.
Another is how to make it read the next page.
The younger brother asks the yellow moderator to give me some advice.


When there are multiple classes, you can take the first few of them for careful research.
As for how to read the next page, specific operations should be performed based on different pages...

Phpquery uses the same syntax as jquery, and jquery can use phpquery.
If you cannot figure it out, go to the w3c website to learn more.

We recommend that you use phpquery. it's pretty good to have a look at it two days ago... you don't need to think about those regular expressions after you have mastered the method.
Thank you, moderator.
There are two other questions that I choose to use. content to capture the content, it will display all the class content on the entire page as a content, so there is no way to tell where it is a content.
Another is how to make it read the next page.
The younger brother asks the yellow moderator to give me some advice.

Think of the Huangdao Main ...... Dongxie

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.