var str = '1亿元万元' // var str = '1000万元' var patt = new RegExp('亿元') var bol = patt.test(str) console.log(bol); console.log(str.slice(0, -2));