I have a text containing HTML and my own special mark-up. Before I print the text, I need to know its length, so I can generate apropriate speech bubble.
I am trying to get the actual length of the string, but I am unable to get length of all special mark-ups.
He're an example of the string
var text = 'Lorem ipsum dolor sit amet [T1]. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam accumsan elit, non vestibulum ex venenatis vitae. <br /><br />[D|1000] Hesitulus <br /> <span class="important"> l[D|100]o[D|100]r[D|100]e[D|100]m</span> <br />'
I am trying to get the length of all "[]"-type substrings using a regexp, but I am no master of that and I fail only having the first one. Tried few more options, but with no success.
var allMyMarkup = text.match( /(\[.*?\])/); // selecting only the first code
How to get all occurences of my pattern?