Home > Article > Backend Development > 正则表达式匹配url地址的问题求救
我想匹配出 http://www.so.com/s?q=csdn&pn=7&j=0里每个搜索结果的url,用下面的正则匹配出的结果为空,错在哪里呢?
$c1 = "/<h3 class=\"res-title (?:mark\-nowrap)?\">\s*<a target=\"_blank\" data-m=\"(?:.*)\" data-pos\"(?:\d+)\" data-e=\"(?:\d+)\" data-st=\"(?:\d+)\" href=\"(.*)\">(?:.*)<\/a>\s*<\/h3>/Uis"; $content= get_content('http://www.so.com/s?q=csdn&pn=7&j=0'); preg_match_all($c1,$content,$arr1); print_r($arr1);