How to solve the regular expression

Source: Internet
Author: User
Tags preg
Tips & quot; & gt; & lt; a & gt; & ask for regular expression
$ Str ='



  • Inexplicable


    Fans: 932


    Venture capitalists





  • Yi xian <


    Fans: 993


    Finance and Economics





  • King


    Fans: 1093


    IT




';

How can this string match the url of each li, imgurl, name, fans, job, such as the first
  • Should match the http://aaa.com/iclock,/images/j22.jpg, inexplicable, 932, venture investors

    ------ Solution --------------------
    PHP code
    [User: root Time: 06: 22: 25 Path:/home/liangdong/php] $ php preg. php Array ([0] => Array ([0] =>
  • Inexplicable

    Fans: 932

    Venture capitalists

  • [1] => http://aaa.com/moming [2] =>/images/j22.jpg [3] => inexplicable [4] => Fans: 932 [5] => venture capitalists) [1] => Array ([0] =>
  • Yi xian <

    Fans: 993

    Finance and Economics

  • [1] => http://aaa.com/yxian [2] =>/images/j7.jpg [3] => yi xian <[4] => Fans: 993 [5] => Finance) [2] => Array ([0] =>
  • King

    Fans: 1093

    IT

  • [1] => http://aaa.com/ikco [2] =>/images/j2.jpg [3] => King [4] => Fans: 1093 [5] => IT) [User: root Time: 06: 22: 26 Path:/home/liangdong/php] $ cat preg. php
  • Inexplicable

    Fans: 932

    Venture capitalists

  • Yi xian <

    Fans: 993

    Finance and Economics

  • King

    Fans: 1093

    IT

  • EOF; $ n = preg_match_all ('/
  • .*

    . * <\/A>. * <\/p> .* (. *) <\/P> .* (. *) <\/P> .*

    (. *) <\/P>. * <\/li>/iUs ', $ str, $ matches, PREG_SET_ORDER); if ($ n) {print_r ($ matches);}?>

  • 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.