现在版本的javascript不支持
(?<!exp) ,零宽度负回顾后发断言(不支持 negative lookbehind)
(?<=exp)也叫零宽度正回顾后发断言(positive lookbehind 不支持) :
可用下面方法代替:
测试例子:
(?<!exp) ,零宽度负回顾后发断言(不支持 negative lookbehind)
(?<=exp)也叫零宽度正回顾后发断言(positive lookbehind 不支持) :
可用下面方法代替:
测试例子:
<script type="text/javascript" >
h='<html id="asd">asdsa12</html>'
//var reg= new RegExp('<\\w+>.*(?=<\/html>)','g')
var tmp=h.match(/<(\w+)[^>]*>.*(?=<\/\1>)/g);
alert(tmp)
tmp=h.replace(/<(\w+)[^>]*>(.*)(<\/\1>)/g,"$2");
alert(tmp)
</script>