javascript separate word and punctuation into array code example Example: how to split by words and punctuation in javascript string.split(/\s*\b\s*/)