How do I use JavaScript to detect
to become one
?
I trie
Simpler:
var newText = oldText.replace(/(){3,}/gi, '');
This will allow optional tag terminator (/>) and also spaces before tag end (e.g. or ).