I have been struggling with this issue for quite some time, the code works fine with latin chars, as for cyrillic, jquery don't recognize it at all.
$('p').each(function() { var $this = $(this);
$this.html($this.text().replace(/\b(\w+)\b/g, "<span>$1</span>"));
});
I have also tried the following code, but for some reason, jQuery skips every second word and doesn't wrap it :(
$(this).html($(this).text().replace(/\s([a-zA-Zа-яА-ЯёЁ]+)\s/g, " <span> $1 </span> "));
Any hint?