求教正则写法,该如何解决
程序员文章站
2022-06-01 23:29:04
...
求教正则写法
$str = '
';
这段字符串怎么匹配出每个li的url,imgurl,name,fans,job,如第一应该分别匹配出http://aaa.com/iclock, /images/j22.jpg,莫名,932,风险投资人
------解决方案--------------------
[1] => http://aaa.com/moming [2] => /images/j22.jpg [3] => 莫名 [4] => 粉丝:932 [5] => 风险投资人 ) [1] => Array ( [0] =>
[1] => http://aaa.com/yxian [2] => /images/j7.jpg [3] => 逸仙 粉丝:993 [5] => 财经 ) [2] => Array ( [0] =>
[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
EOF;$n = preg_match_all('/.*
$str = '
';
这段字符串怎么匹配出每个li的url,imgurl,name,fans,job,如第一
------解决方案--------------------
- PHP code
[User:root Time:06:22:25 Path:/home/liangdong/php]$ php preg.php Array( [0] => Array ( [0] =>
莫名
粉丝:932
风险投资人
逸仙
粉丝:993
财经
称王
粉丝:1093
IT
莫名
粉丝:932
风险投资人
逸仙
粉丝:993
财经
称王
粉丝:1093
IT
.* (.*).*/iUs', $str, $matches, PREG_SET_ORDER);if ($n) { print_r($matches);}?> 相关文章 相关视频