I want to cut this string into 50 characters where (after a space) it starts counting up to 50 (excluding spaces), and if the section is over 50 it inserts a space. So far, I can cut it up, but I don’t know how to specify “exclude spaces”. Tried [^\s] but no joy.
var str = " http://this.domain.com/fff/222/widget.css http://www.domain.com/myfolder/uploads/1/3/3/7/2332053/custom_themes/8787687678644/more_custom_themes/files/my-main_style.css?8763487634 http://cdn.domain.com/folder/images/thisfolder/common.css?9444"
str.replace(/\s(\w.{50})/g,' $1 ');
Try this: