问题:输入:“get1_install2_app3_list4_by5_android6”(每个单词后面总会携带一个数字,只有偶数才删掉)我不用循环只用正则怎么实现输出"get1InstallApp3ListBy5Android"? let str = 'get1_install2_app3_list4_by5_android6' const reg = /(B(?=(_)?)[02468]?)/g const res = str.replace(reg, '') console.log('打印str', res)
let str = 'get1_install2_app3_list4_by5_android6'
const reg = /(B(?=(_)?)[02468]?)/g
const res = str.replace(reg, '')
console.log('打印str', res)
// 打印str get_install_app3_list_by5_android