JSFiddle - React, Tailwind, and code Playground
HTML
<textarea rows="10" cols="50">Great Scott! You're great! Not.
I spit it hot! I generate way more power
than One point twenty one gigawats!
[quote="Randomusername_111"]Anykind of text with numbers 2342342342 and special characters like ?!.s.sfs–––,,,;;;;––––.#+!"[/quote]</textarea>
<div></div>
JavaScript
var text = '';
var char = 0;
text = $('textarea').val();
while (text.match(/\[quote.*\[\/quote\]/i) != null) {
//remove the least inside the innermost found quote tags
text = text.replace(/^(.*)\[quote.*?\[\/quote\](.*)$/gmi, '\$1\$2');
}
// now strip anything non-character
text = text.replace(/[^a-z0-9]/gmi, '');
char = text.length;
$('div').text(char);
$('textarea').bind('input propertychange', function () {
text = $(this).val();
while (text.match(/\[quote.*\[\/quote\]/i) != null) {
//remove the least inside the innermost found quote tags
text = text.replace(/^(.*)\[quote.*?\[\/quote\](.*)$/gmi, '\$1\$2');
}
// now strip anything non-character
text = text.replace(/[^a-z0-9]/gmi, '');
char = text.length;
$('div').text(char);
});