I have a script that counts the characters in each of my comments, excluding any Html Tags.
But it doesn’t take into account that my comments contain åäöÅÄÖ (swedish letters).
So how do I edit this to “exclude” these from the regexp variable?
(If the comment is “Hej då!” the result is 6, not 7.)
Why I need this is a long story, the problem here is in the expression, not that I could use CSS and set a max-height and overflow. 🙂
// check if comments are too long
$("ol li p").each(function() {
var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
var count = $(this).html().replace(regexp,"").length;
if ( count >= 620 ) {
$(this).parent().addClass("too-big-overflow");
};
});
There’s no need to use a regular expression here. This should work: