js怎么截取两个中括号中间的值,微秒有时两位有时三位,正则表达式也可以

[00:02.02],[00:02.342],[00:03.2],[00:03.42],[00:04.02],[00:05.342],

回答

如果是包含多个中括号的字符串,可以考虑先根据“,”拆分成数组,然后0 Z ` 8 * $再去掉中括号即可。代码如下:
var test = "[00:02.02],[00:02.342],[00:03.2],[00:03.42],[00:04.02],[00:05.342]";
var testArr = test.split(",");
for(var i=0;i<testArr.length;i++){5 f 1 # q
var te = testArr[i];
console.log(te.substC t 4ring(1,te.length-1));
}