I have string like
"Shabalu Sheedaa - Ali Gul Panara - Octa School - 10 (7)"
and I want to extract the value between parenthesis using jquery. In this case it will be 7.
I have string like
"Shabalu Sheedaa - Ali Gul Panara - Octa School - 10 (7)"
and I want to extract the value between parenthesis using jquery. In this case it will be 7.
Try:
var regExp = /\(([^)]+)\)/;
var matches = regExp.exec("Shabalu Sheedaa - Ali Gul Panara - Octa School - 10 (7)");
//matches[1] contains the value between the parentheses
console.log(matches[1]);
Explation of Reg Exp:
Breakdown:
\( : match an opening parentheses
( : begin capturing group
[^)]+: match one or more non ) characters
) : end capturing group
\) : match closing parentheses