正则匹配非超链接的url 现在我能获取所有链接,但问题是:我要过滤掉超链接和img中的url,那要如何编写正则呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 比如<a href=\'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\'>sss</a>wefsaffew http://www.w3.org/1999/xhtml这个字串,我只要匹配到http://www.w3.org/1999/xhtml. $s=<<<html<a href=\'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\'>sss</a>wefsaffew http://www.w3.org/1999/xhtmlhtml;preg_match('/http:\/\/.+/i',strip_tags($s),$m);echo $m[0]; 非常感谢,可能我问的不清楚,匹配的结果我是用来替换的(url变超链接). 恩,完整的意思:匹配非超链接的url,匹配的结果用来生成超链接. echo preg_replace('/http:\/\/.+/i','<a href="\0">\0</a>',strip_tags($s)); 前否href=“,后否”。手机无力,没代码。 怎样重定义常量? php js里面的length和PHP里面的strlen区别? 弄过php与flash通信的帮忙: 在使用PHP 的 amfext 扩展的时候遇到问题 对session的判断 500分求,iis6.0 +php5.05+zend的配置问题解决! 求一Mysql批量update语句。 報表 为什么我的XP Home不能链接php_mssql.dll,我已经设置了php.ini和copy到了windows目录 再请教查询名问题 内网访问PHP服务器 数据可以编码问题
<a href=\'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\'>sss</a>wefsaffew http://www.w3.org/1999/xhtml
html;
preg_match('/http:\/\/.+/i',strip_tags($s),$m);
echo $m[0];