let str = 'A-B'
let exp1 = /(?<=(-)).*/g;
let exp2 = /^.*(?=(-))/g;
console.log(str.match(exp1))
console.log(str.match(exp2))
正则 - 截取某个字符后面所有内容
最新推荐文章于 2023-07-26 16:59:47 发布
let str = 'A-B'
let exp1 = /(?<=(-)).*/g;
let exp2 = /^.*(?=(-))/g;
console.log(str.match(exp1))
console.log(str.match(exp2))