php常用标签,PHP 过滤常用标签的正则表达式
在 php 项目中,经常要用到一些过滤标签的正则表达式,收藏一下备用:
$str=preg_replace("/\s+/", " ", $str); //过滤多余回车
$str=preg_replace("/
$str=preg_replace("//si","",$str); //注释
$str=preg_replace("//si","",$str); //过滤DOCTYPE
$str=preg_replace("//si","",$str); //过滤html标签
$str=preg_replace("//si","",$str); //过滤head标签
$str=preg_replace("//si","",$str); //过滤meta标签
$str=preg_replace("//si","",$str); //过滤body标签
$str=preg_replace("//si","",$str); //过滤link标签
$str=preg_replace("//si","",$str); //过滤form标签
$str=preg_replace("/cookie/si","COOKIE",$str); //过滤COOKIE标签
$str=preg_replace("/(.*?)/si","",$str); //过滤applet标签
$str=preg_replace("//si","",$str); //过滤applet标签
$str=preg_replace("/(.*?)/si","",$str); //过滤style标签
$str=preg_replace("//si","",$str); //过滤style标签
$str=preg_replace("/(.*?)/si","",$str); //过滤title标签
$str=preg_replace("//si","",$str); //过滤title标签
$str=preg_replace("/(.*?)/si","",$str); //过滤object标签
$str=preg_replace("//si","",$str); //过滤object标签
$str=preg_replace("/(.*?)/si","",$str); //过滤noframes标签
$str=preg_replace("//si","",$str); //过滤noframes标签
$str=preg_replace("/(.*?)/si","",$str); //过滤frame标签
$str=preg_replace("//si","",$str); //过滤frame标签
$str=preg_replace("/(.*?)/si","",$str); //过滤script标签
$str=preg_replace("//si","",$str); //过滤script标签
$str=preg_replace("/javascript/si","Javascript",$str); //过滤script标签
$str=preg_replace("/vbscript/si","Vbscript",$str); //过滤script标签
$str=preg_replace("/on([a-z]+)\s*=/si","On\\1=",$str); //过滤script标签
$str=preg_replace("//si","&#",$str); //过滤script标签
php常用标签,PHP 过滤常用标签的正则表达式相关推荐
- jq查找字段忽略html标签,jQuery过滤HTML标签并高亮显示关键字的方法
本文实例讲述了jQuery过滤HTML标签并高亮显示关键字的方法.分享给大家供大家参考.具体如下: jQuery实现网页关键字过滤效果,将需要过滤的文字定义在JavaScript中,可定义多个,不过要 ...
- php语句过滤掉html标签_php过滤HTML标签、属性等正则表达式
php过滤HTML标签.属性等正则表达式 本文是百分网小编搜索整理的使用代码实例给出了过滤HTML内容的正则表达式,具体说明请参阅代码中的注释,感兴趣的朋友一起学习吧!!想了解更多相关信息请持续关注我 ...
- js 正则表达式过滤html标签,js过滤html标签的方法
在js中,可以通过 replace() 方法,将一串含有html标签的字符串中的html标签过滤掉,本文就来详细的介绍一下,js中过滤html标签的方法. js replace() 方法定义与介绍 r ...
- php语句过滤掉html标签_php过滤html标签
标签: php自带函数strip_tags echo strip_tags("hello world! "); 自定义函数: function filterhtml($str) { ...
- PHP中过滤常用标签的正则表达式
$str=preg_replace("/\s+/", " ", $str); //过滤多余回车 $str=preg_replace("/<[ ] ...
- php 正则过滤style,PHP 过滤常用标签的正则表达式
$str=preg_replace("/\s+/", " ", $str); //过滤多余回车 $str=preg_replace("/ $str=p ...
- PHP过滤常用标签的正则表达式
<?php$str=preg_replace("/\s+/", " ", $str); //过滤多余回车 $str=preg_replace(" ...
- Python正则匹配HTML,python正则匹配html标签_Python爬虫常用正则表达式及HTML网页标签分析总结...
这篇文章主要是介绍Python爬取网页信息时,经常使用的正则表达式及方法.它是一篇总结性文章,实用性比较大,主要解决自己遇到的爬虫问题,也希望对你有所帮助~ 当然如果会Selenium基于自动化测试爬 ...
- python正则匹配html标签_Python爬虫常用正则表达式及HTML网页标签分析总结
这篇文章主要是介绍Python爬取网页信息时,经常使用的正则表达式及方法.它是一篇总结性文章,实用性比较大,主要解决自己遇到的爬虫问题,也希望对你有所帮助~ 当然如果会Selenium基于自动化测试爬 ...
最新文章
- 【Hibernate】Hibernate基本原理及概念详解
- php魔术方法 效率,PHP常用魔术方法的性能探究
- Unity2018.2中文更新日志速览版
- ZOJ Problem Set - 1008
- 开发者友好性和易用性
- 20190904:(leetcode习题)合并两个有序数组
- ubuntu防火墙关闭命令-转
- virtualbox 安装 虚拟机的时候报错不能创建新任务
- 自学python买什么教材-Python 有哪些入门学习方法和值得推荐的经典教材?
- java io知识点汇总FIle类
- 迅雷11抢先体验版,免费2T空间可离线不限速取回
- 2021-10-28
- oracle 快速检索表名称及包含的字段名称
- c++编译STL文件反转其法线
- 华为机试真题 C 实现【非严格递增连续数字序列】【2022 Q4新题】
- 用html做完整网页效果
- [8]Deep Learning Software-深度学习软件
- 嵌入式设备的网络性能该如何分析
- 传感器的灵敏度 分辨率与分辨力和精度 + 光纤光缆
- 网新恒天2011 9 21招聘会笔试题