let romName = ' 123(kjjkd)llk k(hvh)';
romName = romName.replace(/\([^\(\)]*\)/g, ''); //去除所有()的内容
romName = romName.replace(/\s*/g,''); //去除所有空格
console.log(romName); // 123llkk
let romName = ' 123(kjjkd)llk k(hvh)';
romName = romName.replace(/\([^\(\)]*\)/g, ''); //去除所有()的内容
romName = romName.replace(/\s*/g,''); //去除所有空格
console.log(romName); // 123llkk
本文标题:常用正则自用
本文链接:https://www.haomeiwen.com/subject/rowaahtx.html
网友评论