I have the following function in my JS
var p = $('.page p');
p.html(function(index, oldHtml) {
return oldHtml.replace(/\b(\w+?)\b/g, '<span class="word">$1</span>')
});
This breaks up every word of paragraph. However words that have apostrophes (e.g don't, craig's) get split up to two part (e.g don and t)
How can I amend the code to make these complete words and keep in the apostrophe?
Thanks