📅  最后修改于: 2022-03-11 15:01:46.435000             🧑  作者: Mango
var str="hello how are you"
var size=3
console.log(str.match(new RegExp('.{1,' + size + '}', 'g')))
//returns ["hel","lo ","how"," ar","e y","ou"]