javascript split on multiple characters code example
Example 1: js split string every n characters
foo.match(new RegExp('.{1,' + n + '}', 'g'));
Example 2: how to split by words and punctuation in javascript
string.split(/\s*\b\s*/)
foo.match(new RegExp('.{1,' + n + '}', 'g'));
string.split(/\s*\b\s*/)