常用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);