我从http://ar.wikipedia.org复制了一些段落 包含许多[15],[89],[等等] 我希望我们使用JavaScript或jQuery自动删除[]中的任何内容。
答案 0 :(得分:0)
试试这个常规exp。
test = "[5] new value";
test = test.replace(/\[(.+?)\]/, '$1');
alert(test);
test = "FIFA publishes its results according to IFRS. The total compensation for the management committee in 2011 was 30 million for 35 persons. Blatter, the only full time, earns approx 2 Mio CHF, 1.2 Mio fix, the rest bonus.[4][5][6]";
test = test.replace(/\[(.+?)\]/g, '$1');//for global replace
alert(test);