PHP regular problem

Source: Internet
Author: User
Ask a regular formula to intercept the string:
For example, in a piece of text I want to get this text (not including double quotes): "As of 2013-09-30, this is some text, this is some text." ”
How do you write with regular? I want to match "up to 2013-09-30 xxxxxxx." ”


Reply to discussion (solution)

XXXX refers to what, exactly match to where

Preg_match_all (' ~ Up to (. *?). ~ '), and find the start and end tags just fine.

XXXX refers to what, exactly match to where

XXXX is omitted
For example "This is a text,,,,,,, as of 2013-09-30, I have reached 1 million hits. This is a piece of text ... "I'm going to take it out." As of 2013-09-30, I reached 1 million hits. "This Part

$s = ' This is a text,,,,,,, I have reached 1 million hits by 2013-09-30. This is a piece of text ... ' Preg_match ('/up (. +?). /', $s, $m); Echo $m [0];

$s = ' This is a text,,,,,,, I have reached 1 million hits by 2013-09-30. This is a piece of text ... ' Preg_match ('/up (. +?). /', $s, $m); Echo $m [0];

Thank you so much!
  • 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.