求匹配出中文的正则表达式 15
求高手帮帮写出匹配一下文字中中文的正则表达式,最好是匹配<liclass="title"mx-ie="mouseover,mouseout"></li>这个标签之间的中文...
求高手帮帮写出匹配一下文字中中文的正则表达式,最好是匹配<li class="title" mx-ie="mouseover,mouseout"></li> 这个标签之间的中文。
<li class="title" mx-ie="mouseover,mouseout"> <span class="color-red">[年终特价]</span> <a target="_blank" href="" mx-ie="mouseover,mouseout"><span class="H">童装</span>男童裤子冬款棉裤加绒加厚儿童运动裤大男童冬裤女童<span class="H">冬装</span>长裤</a> </li> 展开
<li class="title" mx-ie="mouseover,mouseout"> <span class="color-red">[年终特价]</span> <a target="_blank" href="" mx-ie="mouseover,mouseout"><span class="H">童装</span>男童裤子冬款棉裤加绒加厚儿童运动裤大男童冬裤女童<span class="H">冬装</span>长裤</a> </li> 展开
1个回答
展开全部
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<title>last.html</title>
<style>
</style>
<script type="text/javascript">
onload = function ()
{
var html = ul.innerHTML;
var reg = new RegExp (".*\\<li\\s+class[\\=\\s\"\']+title[\'\"]\\s+mx\\-ie[\\=\\s\"\']+mouseover[\\,\\s]+mouseout[\'\"]\\>([\\s\\S]*)\\<[\\/\\s]+li\\s*\\>.*", "gim");
var result = html.replace(reg, "$1");
console.warn (html);
console.info (reg.test(html));
console.log (result);
result = result.replace(/[^\u4e00-\u9fff]/g, '');
console.debug (result);
}
</script>
</head>
<body>
<ul id="ul">
<li class="title" mx-ie="mouseover,mouseout">
<span class="color-red">[年终特价]</span>
<a target="_blank" href="" mx-ie="mouseover,mouseout">
<span class="H">童装</span>男童裤子冬款棉裤加绒加厚儿童运动裤大男童冬裤女童<span class="H">冬装</span>长裤</a>
</li>
</ul>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询