alert('rgb(255)'.match(/rgb\((\d+)\)/));寻找匹配项 搞不懂为何返回["rgb(255)", "255"]?为何不是只返回"rgb(255)"
1 回答
大话西游666
TA贡献1817条经验 获得超14个赞
因为你用了捕获,就是那个括号。
console.log('rgb(255)'.match(/rgb\((\d+)\)/));不用捕获就对了
console.log('rgb(255)'.match(/rgb\(\d+\)/));添加回答
举报
0/150
提交
取消
