var aa="ldfjsldfj(dsfasjfj3124123)";There is any content in the parentheses, how to match it
业精于勤,荒于嬉;行成于思,毁于随。
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
/(.+)/
Only take out the contents of parentheses