How to obtain the number of digits in the Baidu ranking keyword is mainly a regular expression.

Source: Internet
Author: User
To obtain the ranking digits of the keyword Baidu, use a regular expression, such as searching for csdn from Baidu. The result is as follows: HTMLcode & lt; tablecellpadding = & quot; 0 & quot; cellspacing = & quot; 0 & quot; class = & quot; result & quot; method for obtaining the number of digits in the keyword Baidu ranking, which is mainly a regular expression
For example, search for csdn from Baidu,
The result is as follows:
HTML code
  
  
  

Where









When the 1 in id = "1" is based on the csdn keyword, Baidu naturally ranks www.csdn.net. In "'})" href = "http://www.csdn.net/" target = "_ blank"> "this string contains the first 15th characters and is also his ranking number 1Now I can only get the entire search result from file_get_contents. how can I "extract" 1 of this id = "1? Thank you for your advice!My idea is, from "'})" href = "http://www.csdn.net this code goes forward to search for 15th notes, get him, can also.Thank you for your advice!------ Solution --------------------After, no one answered the question. it looks like they are all in a coma.$ Str ='



}';$ Pat = '/id = "([0-9]) + "/';Preg_match ($ Pat, $ Str, $ Marray );Echo $ Marray [1];

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.