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)