我有像
这样的字符串" Shabalu Sheedaa - Ali Gul Panara - Octa School - 10(7)"
我想用jquery在括号之间提取值。 在这种情况下,它将是7。
答案 0 :(得分:0)
尝试:
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]);
Reg Exp:
的解释Breakdown:
\( : match an opening parentheses
( : begin capturing group
[^)]+: match one or more non ) characters
) : end capturing group
\) : match closing parentheses