Code being used:

Code:
<script type="text/javascript">
$('td.c_post').each(function () {
var words = $(this).html().replace(/<blockquote>(.*?)<\/blockquote>/g, '').replace(/<div class="spoiler_toggle">(.*?)<\/div>/g, '').replace(/<div class="spoiler">(.*?)<\/div>/g, '').replace(/<br \/>/g, '').split(' ').length;
$(this).append('<br /><br /><span class="word_count"><big><strong>' + words + '</strong> Words</big></span>');
});
</script>
Here: http://s1.zetaboards.com/Cory/topic/4616513/

See how it only counts each line when there is multiple lines, as the example shows in post #6, how do I prevent this and make it count all words? I'm using replace() so it won't count words in specific HTML elements and to remove the line breaks, and split() to remove the spaces so it will count all words, but it doesn't seem to be working correctly.