javascript - js regular match the content in parentheses
迷茫
迷茫 2017-07-05 10:39:41
0
2
741

var aa="ldfjsldfj(dsfasjfj3124123)";
There is any content in the parentheses, how to match it

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
ringa_lee
var aa="ldfjsldfj(dsfasjfj3124123)";
var result = aa.match(/\(([^)]*)\)/);
// 此时result=["(dsfasjfj3124123)", "dsfasjfj3124123"];
if (result) {
    console.log(result[1]); // "dsfasjfj3124123"
}
小葫芦

/(.+)/

Only take out the contents of parentheses

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template