Regular expression matching, what to do with

Source: Internet
Author: User
Regular expression Matching
Want to match this format with regular expressions
  • News Center





    $con = file_get_contents ("http://17173.com");

    $preg = ' #
  • (.*)#';



    Print_r ($arr [1]);

    foreach ($arr [1] as $id = + $v) {

    echo "". $v. " ". $arr [2][$id]."
    ";

    }

    ?>



  • The match result is nothing, but this page is linked in this format, solving


    ------Solution--------------------
    First target= "_blank" and the above given is not in line with, in the end is Which?

    and then Echo $con;

    Identify the content that is expected
    Pay attention to case and line breaks-your regular case is fixed, the dot is not a newline
    ------Solution--------------------
    Preg_match_all ('/

  • (.*?) <\/a>/i ', $str, $matches);
    Var_dump ($matches [1]);

    Your problem is: People's website content is target=_blank such, and your target= "_blank" is this, more quotes, not 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.