查找:
ellora[sidebar-1]并且只替换数字,特别是在方括号之间查找文本(包括左括号和右括号),然后替换。使用replace()
method.result应该是这样的
ellora[sidebar-2], ellora[sidebar-3], ...发布于 2011-10-09 03:08:30
如下所示:
s = s.replace(/(\w+\[\w+[_-])(\d+)(\])/g, function(str, p1, p2, p3) {
return p1 + (parseInt(p2) + 1) + p3;
});https://stackoverflow.com/questions/7699071
复制相似问题