Javascript regex to match html comments, excluding those inside <style> tags
I need to get html comments ( <!-- -->
) except for those inside tags, which are used sometimes.
<style type="text/css">
<!--
.test { font-size: 12px; }
-->
</style>
Getting html comments is quite easy with this regex:开发者_如何学C
/<!--[^>]*-->/gi
The issue is that i can't exclude those that are inside tags. I tried:
(?!<style[^>]>)
but it still get the html comment. Any ideas?
Thanks!
精彩评论