-
-
header("Content-type:text/html;charset=utf-8");
- $str = '';
- $pattern = "/[img|IMG].*?src=['|\"](.*?(?:[.gif|.jpg]))['|\"].*?[\/]?>/";
- preg_match_all($pattern,$str,$match);
- echo "";
- print_r($match);
- ?>
复制代码
附,php过滤html标签、属性等正则表达式汇总。
-
- function DeleteHtml($str)
- {
- $str = trim($str);
- $str = strip_tags($str,"");
- $str = ereg_replace("\t","",$str);
- $str = ereg_replace("\r\n","",$str);
- $str = ereg_replace("\r","",$str);
- $str = ereg_replace("\n","",$str);
- $str = ereg_replace(" "," ",$str);
- return trim($str);
- }
复制代码
|