Home  >  Article  >  php教程  >  php 正则 过滤html 的超链接

php 正则 过滤html 的超链接

WBOY
WBOYOriginal
2016-06-13 12:23:52789browse

echo preg_replace("/(?]*)(?=\>)/i","#", "你好,点这里看看你好,点这里看看");
?>
正则:/(?]*)(?=\>)/
(?(?=exp) 匹配exp前面的位置
此正则 匹配 在 href= 之后 “>” 之前 的 非 “>” 的所有字符
例子:
找到这些字符(url)用 # 替换,就可以去掉html里的所有链接。

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