SOURCE

// 输入 50a6we8y20x 输出 50 个 a,6 个 we,8 个 y,20 个 x
const test = "50a6we8y20x"
const reg = /([1-9][0-9]*)([a-z]+)/
// console.log(test.match(reg))
function print(str){
    if(reg.test(str)){
       const times = parseInt(str.match(reg)[1])
        const words = str.match(reg)[2]
        console.log(times)
        console.log(words)
        // for(let i = 1; i<=times; i++){
        //     console.log(words)
        // }
        str = str.replace(reg,"")
        print(str)
    }else{
        return
    }
}

print(test)
console 命令行工具 X clear

                    
>
console