从"1000mm"拿到数值和单位 var str = "1000mm" let unit = str.replace(/[^a-z]+/ig,"") let num = str.replace(/[^0-9]/ig,"") console.log(unit) // 1000 console.log(num) // mm 人若有志,就不会在半坡停止!