常用HTML正则

<?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);

 

posted on 2016-05-31 13:47  岩_生  阅读(275)  评论(0编辑  收藏  举报

导航