Home  >  Article  >  Backend Development  >  求教正则写法,该如何解决

求教正则写法,该如何解决

WBOY
WBOYOriginal
2016-06-13 13:23:31781browse

求教正则写法
$str = '



  •  求教正则写法,该如何解决


    莫名


    粉丝:932


    风险投资人




  •  求教正则写法,该如何解决


    逸仙

    粉丝:993


    财经




  •  求教正则写法,该如何解决


    称王


    粉丝:1093


    IT




  ';

这段字符串怎么匹配出每个li的url,imgurl,name,fans,job,如第一
  • 应该分别匹配出http://aaa.com/iclock, /images/j22.jpg,莫名,932,风险投资人

    ------解决方案--------------------
    PHP code
    [User:root Time:06:22:25 Path:/home/liangdong/php]$ php preg.php 
    Array
    (
        [0] => Array
            (
                [0] => 
  •  求教正则写法,该如何解决

    莫名

    粉丝:932

    风险投资人

  • [1] => http://aaa.com/moming [2] => /images/j22.jpg [3] => 莫名 [4] => 粉丝:932 [5] => 风险投资人 ) [1] => Array ( [0] =>
  •  求教正则写法,该如何解决

    逸仙

    粉丝:993

    财经

  • [1] => http://aaa.com/yxian [2] => /images/j7.jpg [3] => 逸仙 粉丝:993 [5] => 财经 ) [2] => Array ( [0] =>
  •  求教正则写法,该如何解决

    称王

    粉丝:1093

    IT

  • [1] => http://aaa.com/ikco [2] => /images/j2.jpg [3] => 称王 [4] => 粉丝:1093 [5] => IT ) ) [User:root Time:06:22:26 Path:/home/liangdong/php]$ cat preg.php
  •  求教正则写法,该如何解决

    莫名

    粉丝:932

    风险投资人

  •  求教正则写法,该如何解决

    逸仙

    粉丝:993

    财经

  •  求教正则写法,该如何解决

    称王

    粉丝:1093

    IT

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

    .*.* 求教正则写法,该如何解决 .*.*.*(.*).*(.*).*

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

  • Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn