I am trying to get the count (length) of all matching HTML characters including opening (`<tag>`) and closing (`</tag>`) including any `attributes`

Consider the following HTML: 

```
<div>
    <a href="#">link</a>
    <span>some text</span>
</div>

```

The HTML character length count will be **40**
(as it counts `<div><a href="#"></a><span></span></div>`)

[This is the working regExp (on gskinner.com)](http://regexr.com?33f1m)

But when using it in javascript there is a error  

See [jsfiddle](http://jsfiddle.net/adardesign/GL5yP/)