var s = '<--something--><++something++><**something**>',
p = s.match(/(<[^>]+>)/g);
console.log(p); // ["<--something-->", "<++something++>", "<**something**>"]
That's only assuming that each "token" will never have a >
within. So, it will fail with the following:
<--some>thing--><++something++><**something**>
^ problematic
I would like to stress that if you're using this to parse HTML, stop right there. Regex isn't the right solution if you're looking to grab specific elements out of HTML. instead, place the content in a hidden <div>
(or something) and use the native DOM accessors.