Home  >  Article  >  Backend Development  >  帮忙写一个正则,替换超连接。多谢

帮忙写一个正则,替换超连接。多谢

WBOY
WBOYOriginal
2016-06-13 11:33:17748browse

帮忙写一个正则,替换超连接。谢谢!
我想替换超连接中的 http://www.baidu.com 变为 http://google.com/?url=http://www.baidu.com

现在找到一代码可以替换,但是不知道先怎么取出 http://www.baidu.com 然后加上 http://google.com/?url= 然后替换回去,变为 http://google.com/?url=http://www.baidu.com
的效果。

$str = '点击观看棋谱';    echo preg_replace("/(?]*)(?=\>)/i","#", $str); 



能帮写一个替换正则吗! 
替换字符串中所有的超级连接

谢谢了啊

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn