[英]Regex to extract word from a line
I am trying to extract the word(s) inside round brackets. 我正在尝试提取圆括号内的单词。
Code: 码:
$('.vote').each(function() {
var vote_count = $('.vote .likedButton').attr('title');
var split_count = vote_count.replace(/\(([^)]+)\)/,"");
alert(split_count);
});
The string I am trying to get- 我想得到的字符串-
Message reputation : 50% (2 votes)
trying to get 2 votes Message reputation : 50% (2 votes)
试图获得2票
The JavaScript Regex I have above is only deleting this line. 我上面的JavaScript正则表达式仅删除此行。 Am I missing some regex or do I need to use 我是否缺少一些正则表达式或需要使用
.match(/\(([^)]+)\)/);
Can someone explain thank you 有人可以解释谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.