正则表达式匹配符号之间的内容

2024-12-23 02:26:09
推荐回答(1个)
回答1:

var str = '@dda#fdead@eee#ddsa';
var reg = /@[^#]+#/g;
var array = str.match(reg)
for(var i=0,len=array.length;iarray[i] = array[i].replace("@","").replace("#","");
}
alert(array)