Home >Backend Development >PHP Tutorial >网址自动加链接和ubb代码冲突的有关问题,如何解决

网址自动加链接和ubb代码冲突的有关问题,如何解决

WBOY
WBOYOriginal
2016-06-13 11:31:561084browse

网址自动加链接和ubb代码冲突的问题,怎么解决?
preg_replace("#((mms|http|https|ftp|telnet)(://)[.:@/\w\?\=\-\&\_\#\;\%\,\!\+]+)#i","\\1",$text);

上面是给一段文字里面的网址自动加链接的,但是有的ubb代码的链接不能自动加链接,要怎么排除?因为ubb会自动转换为链接。
比如这个:http://bbs.csdn.net/topics/new?forum_id=PHPBase
怎么排除有[url]或者[img]这种标签里面的链接不要自动加链接?或者有没有其它正则可以做到?
谢谢!

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