javascript - Get only the string inside a curly brackets -
this question has answer here:
i have number of strings
var str="#{zydt8spgzoa.mi8uhat7o47}+#{z3penrrf0cn.mi8uhat7o47}+#{lhubsvcmpwu.mi8uhat7o47}+#{ynpiwu7fw9m.mi8uhat7o47}";
i need content inside curly bracket array. (in above case array of length 4).
how can achieve this?
var found = [], rxp = /{([^}]+)}/g, str = "#{zydt8spgzoa.mi8uhat7o47}+#{z3penrrf0cn.mi8uhat7o47}+#{lhubsvcmpwu.mi8uhat7o47}+#{ynpiwu7fw9m.mi8uhat7o47}", mat; while( mat = rxp.exec( str ) ) { found.push(mat[1]); } alert(found);
Comments
Post a Comment