I have these two strings...
var str1 = \"this is (1) test\"; var str2 = \"this is (2) test\";
And want to write a RegEx to extract what is
try this
var re = (/\((.*?)\)/g); var str1 = str1.match(/\((.*?)\)/g); var new_str1=str1.substr(1,str1.length-1); var str2 = str2.match(/\((.*?)\)/g); var new_str2=str2.substr(1,str2.length-1); var str3 = new_str1+new_str2; //produces "12"