var str= '00asfasdfasdf3435asdas874747474asdf';
let a = str.replace(/[0-9]/g, function(match) {
return (Number(match) + 1)
})
console.log(a) // 11asfasdfasdf4546asdas985858585asdf
var str= '00asfasdfasdf3435asdas874747474asdf';
let a = str.replace(/[0-9]/g, function(match) {
return (Number(match) + 1)
})
console.log(a) // 11asfasdfasdf4546asdas985858585asdf
本文标题:正则表达式将字符串中所有的数字加1
本文链接:https://www.haomeiwen.com/subject/kexthltx.html
网友评论