let list=[]
let str = '去微乎其微#{111}客气未来#{332}期间我渴望了#{456}请叫我饿请问我去'
str.replace(/\#\{(.+?)\}/g,function (match,param,offset,string) {
// /\#\{(.+?)\}/g 获取的是 #{ } 里面的内容
console.log(match,param,offset,string);
list.push(param)
})
console.log(list) //[111,332,456]
js 字符串中检索出所有的被标记的字符
最新推荐文章于 2024-02-07 13:24:33 发布