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 INSIDE the parentheses as in "1"
and "2"
to produce a string like below.
var str3 = "12";
right now I have this regex which is returning the parentheses too...
var re = (/((.*?))/g);
var str1 = str1.match(/((.*?))/g);
var str2 = str2.match(/((.*?))/g);
var str3 = str1+str2; //produces "(1)(2)"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…