我想在我的HTML中替换[0]的每个实例,但我现在使用的正则表达式替换所有0不仅仅是[0]。下面是我有:Javascript正则表达式替换[0]而不是0
var clone = clone.html().replace(/[0]/g, total); // Total is a number that increments
什么,我会更换一个例子是这样的:
<input id="Items[0].Id" name="Items[0].Id" value="0" type="text" />
但在价值=“0”以上的JavaScript代替0,任何想法,我正在下降通过?
请有人重新关闭http://stackoverflow.com/questions/928072/whats-the-regular-expression-that-matches-a-square-bracket –