<textarea id="htmlCode" rows="5" cols="50">
<namespace:span id="1/">'
>" name= spanName />
<span id="2">
<span id="3" />
<span id="4">
<span></span>
</span>
<span id="6" />
<div></div>
</span>
<div>
<div></div>
</div>
<span id="5"></span>
</textarea>
<br />
<script>
function htmlTag()
{
re = /<(///s*)?((/w+:)?/w+)(/w+(/s*=/s*((["'])(//["'tbnr]|[^/7])*?/7|/w+)|.{0})|/s)*?(///s*)?>/ig
return htmlCode.value.match(re)
}
</script>
<button οnclick="alert(htmlTag().join('/n------------------------------------/n'))">匹配</button>