The main task of matching PHP regular expressions today is to compare the recent upload time of news, research reports, and other consultations with the local time and compare whether the record has exceeded 1 hour, then I programmed php for this.
At the beginning, I thought there was some text information to be processed on the homepage, but I have not found the text information for a long time, at the beginning, I did not find that I had been using regular expressions to process the source code of html. later, I found that it was my own problem, the original html source code does not contain news code. Then I used chrome to search for the page and finally found the url of the news page source. Then process the url.
When processing the url, I directly use a regular expression for processing, but there are various problems during processing. First, the length of the time string may change with time, so at first I didn't know how to handle it. then I tried it for a long time. later, I tried it. * match the text, but because greedy match is used by default in php, a match matches everything, and then I search for it, the solution cannot be found for a long time.
Later, I asked one of my students, who told me that regular expressions use greedy matching by default. this problem can be solved if the pattern can be changed to non-greedy match.
For example, there is a piece of html:AsdefCcdaAae
Sdc
AsdefDfge
Sdc
. I want to use the rules through preg_match_all\ S *
Set
AsdefCcdaAae
But PHP does not seem to have any option for non-greedy mode.
AsdefCcdaAae
Sdc
AsdefDfgeBecause the greedy pattern matches
Now
/Regular/U parameter U, the original words in the book are, no longer greedy
Then I finally solved the problem.
= 3600) {/* compare whether the system time is greater than the last update time of 1 hour. If yes, the system time is incorrect. if not, the system time is correct */echo "this is false
";} Else {echo" this is true
";} Echo $ time ,"
"; Echo $ effecime;} echo" "; if (isset ($ _ POST ['URL']) & $ _ POST ['URL']! = '') {$ Url2 =$ _ POST ['URL']; limittimeindex ($ url2) ;}?>
Http://zhidao.baidu.com/question/110658951.html? Qq-pf-to = pcqq. C2C