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);}?>