//映射了税号和分类单元。我想从数组的每个元素中删除IGST:output,因为我正在使用正则表达式,但是由于以下提到的错误而失败。
var taxamt=[150229.13,81123.77,100,100,50];
taxhead=["IGST:Output IGST @ 18%","IGST:Output IGST @ 18%","CGST:Output CGST @ 18%","CGST:Output CGST @ 9% SGST:Output SGST @ 9%","CGST @ 9%"];
var temp=Array(taxhead.length).fill(false);
var taxheadtemp=[];
for(var i=0;i<taxhead.length;i++)
{
let temp3 = taxhead[i].match(/(?<=gst:output)(.*?%)/ig);//error:invalid quantifier ?
if(temp3 != null) {
taxheadtemp.push(...temp3);
}
}
console.log(taxheadtemp);
什么是脚本类型?我的意思是是服务器端(例如,用户事件,Suitelet)还是客户端脚本?
如果是服务器端脚本,并且您使用的是套件脚本2.0,而不是2.x或2.1,则spread operator将不起作用,而您必须使用Array.concat。