情感剧场:爱情公寓精装版
剧情
只想匹配class为black的超链接,不想匹配 class="font12-orange"
请问大神们,正则怎么写?
$str = <<<EOF<a href="http://jq.tvsou.com/introhtml/14/index_1468.htm" target="_blank" class="black">情感剧场:爱情公寓精装版</a><a href="http://jq.tvsou.com/introhtml/730/index_73026.htm" target="_blank" class="font12-orange">剧情</a>EOF;preg_match('/<a href="([^"]+?)"[^>]+?class="black">(.+?)<\/a>/i',$str,$m);echo "<pre class="brush:php;toolbar:false">";print_r($m);echo "
$zz='/(.*)?<\/a>/';
$str =<<<FDIPZONE <a href="http://jq.tvsou.com/introhtml/14/index_1468.htm" target="_blank" class="black">情感剧场:爱情公寓精装版</a><a href="http://jq.tvsou.com/introhtml/730/index_73026.htm" target="_blank" class="font12-orange">剧情</a> <a href="http://jq.tvsou.com/introhtml/14/index_1468.htm" target="_blank" class="black">情感剧场:爱情公寓精装版</a><a href="http://jq.tvsou.com/introhtml/730/index_73026.htm" target="_blank" class="font12-orange">剧情</a> <a href="http://jq.tvsou.com/introhtml/14/index_1468.htm" target="_blank" class="black">情感剧场:爱情公寓精装版</a><a href="http://jq.tvsou.com/introhtml/730/index_73026.htm" target="_blank" class="font12-orange">剧情</a>FDIPZONE;preg_match_all('/<a.*?href="(.*?)".*?class=\"font12-orange\"/si',$str, $matches); echo "<pre class="brush:php;toolbar:false">";print_r($matches[1]);echo "
正在学习正则表达式,学习了!