这样肯定得不到你的链接。
因为上面 的正则是有 ^,$的限制。
将正则改成:
preg_match("/http.*www\.abc123\.com\.cn\/m\/(\w{3,})/is",$str,$m);
preg_match("/http:\/\/(\w{3,})\.service\.abc123\.com\//",$str2,$m2);
因为上面 的正则是有 ^,$的限制。
将正则改成:
preg_match("/http.*www\.abc123\.com\.cn\/m\/(\w{3,})/is",$str,$m);
preg_match("/http:\/\/(\w{3,})\.service\.abc123\.com\//",$str2,$m2);
$str = file_get_contents($url);
preg_match("/http.*blog\.csdn\.net\/(\w{3,})/is",$str,$m);
print_r($m);?>可这样写输出的是CSDN博客首页的内容,而不是一个个的链接,请大家赐教。
$str = file_get_contents($url);
preg_match("/http.*blog\.csdn\.net\/(\w{3,})/is",$str,$m);
print_r($m);?>这样取出不是满足
http://blog.csdn.net/这里不限/
和
http://这里不限.blog.csdn.net/
$str = file_get_contents($url);
preg_match("/http.*blog\.csdn\.net\/(\w{3,})/is",$str,$m);
print_r($m);?>这样取出不是满足
http://blog.csdn.net/这里不限/
和
http://这里不限.csdn.net/
$str = file_get_contents($url);
preg_match_all("|http://blog\.csdn\.net/\w+|i",$str,$m);
print_r($m);?>不知道对不。。
再给你个例子:
$str = <<<OF
href="http://www.csdn.net/ibma/
href="http://www.csdn.net/ibmb/
href="http://www.csdn.net/ibmc/
href="http://www.csdn.net/ibmd/
OF;preg_match_all("/http:\/\/(.*?)\/\w{3,}\//s",$str,$m);
print_r($m);