javascript - Get only the string inside a curly brackets -


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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -