正則表示式匹配所有不包含 css 的 html 標籤
阿新 • • 發佈:2018-12-25
需求
取出下列html標籤中的css標籤
<meta content='Flat administration template for Twitter Bootstrap.' name='description'>
<link href="assets/stylesheets/bootstrap/bootstrap.css" media="all" rel="stylesheet" type="text/css" />
<link href="assets/stylesheets/bootstrap/bootstrap-responsive.css" media ="all" rel="stylesheet" type="text/css" />
<script src="assets/javascripts/plugins/fileupload/tmpl.min.js" type="text/javascript"></script>
<script src="assets/javascripts/plugins/fileupload/load-image.min.js" type="text/javascript"></script>
解決
正則 :
<\/?\w+(?!.*\.css).*?\/?>