How to write regular expressions?

Source: Internet
Author: User
How can I write a regular expression? how can I write a regular expression?
Http://www.nhdali.com/zsxx/news02.php want to match here 'Investment and economic dynamic column' written for a long time can not be written, almost between ''and'' content.

------ Solution --------------------
There are still pages.

------ Solution --------------------
No one has returned to you yet? It seems that I am idle.


/(? :) ([\ S \ S] + )(? :)/IU
------ Solution --------------------
$ Con = file_get_contents ("http://www.nhdali.com/zsxx/news02.php? Page = ". $ _ GET [id]);
$ Preg = "# (. *) # iUs ";
Preg_match_all ($ preg, $ con, $ arr );

------ Solution --------------------
PHP code
$ Str = file_get_contents ("http://www.nhdali.com/zsxx/news02.php"); $ match = "/] *?> (.*?) <.*? Em> (.*?) <\/Em> .*?([^ <] *?)------ Solution --------------------
It is estimated that this content will be matched, and the title, content, and url resolution of each specific information will be required!

Using dom + xpath is much better than analyzing it once and then again!

In addition, we recommend that you use regular expressions on the fourth floor to find all the content you want!
------ Solution --------------------
Discussion

I would like to ask what the last iUs of regular expressions means on the third and fourth floors. I is case-insensitive. I don't know anything else!

------ Solution --------------------
Discussion

Reference:

I would like to ask what the last iUs of regular expressions means on the third and fourth floors. I is case-insensitive. I don't know anything else!


U is encoded according to unicode, and s is. can represent any blank character

------ Solution --------------------
$ Str_pre = '/\ s *(.*?) <\/A> (.*?) \ S *(.*?) <\/Em> \ s * <\/span> \ s *([\ W \ W] *?) | (.*?)) <\/Small> /';
This can be used to match!

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.