how to split word at second instance of a letter javascript code example Example: js split string every n characters foo.match(new RegExp('.{1,' + n + '}', 'g'));