Why is the last number missing when preg_match_all () regular expression is used to retrieve data?

Source: Internet
Author: User
Why is the last number missing when preg_match_all () regular expression is used to retrieve data? Preg_match_all ('/id = (. *) [0-9]/', 'http: // www.baidu.com/go.htm? Spm = a1z10.1. w5003-4193336463.1.aoWyoL & id = 35468681941 & scene = baidu_session ', $ id );

I want to get the id value in the URL.
In the above example, we can only get 3546868194, with 1 missing. Why?


Reply to discussion (solution)

You can write it like this. thank you.
Preg_match_all ('/id \ = (\ d + )/',

Well, I only know how to change it. I don't know why... if you only want to match a number, as long as/id = [0-9,
/Id = (. *) [0-9]/this is too messy and the connection mode unit is used ..

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.