码迷,mamicode.com
首页 > Web开发 > 详细

常用HTML正则

时间:2016-05-31 15:51:42      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:

<?php

//HTML a连接正则
$str = ‘‘;
$isMatched = preg_match(‘/<a.*?[^<]>.*?<\/a>/‘, $str, $matches);
var_dump($isMatched, $matches);


//HTML js正则
$str = ‘‘;
$isMatched = preg_match(‘/<script[\s\S]*?<\/script>/‘, $str, $matches);
var_dump($isMatched, $matches);

//HTML img正则
$str = ‘‘;
$isMatched = preg_match(‘/<img[^>]*>/‘, $str, $matches);
var_dump($isMatched, $matches);

 

常用HTML正则

标签:

原文地址:http://www.cnblogs.com/shanyansheng/p/5545630.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!