以下代码在控制台中运行,但是,在Suitescript 2.0中不起作用。脚本给出错误“无效的量词?”在第7行

问题描述 投票:0回答:1

//映射了税号和分类单元。我想从数组的每个元素中删除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);
netsuite suitescript2.0
1个回答
0
投票

什么是脚本类型?我的意思是是服务器端(例如,用户事件,Suitelet)还是客户端脚本?

如果是服务器端脚本,并且您使用的是套件脚本2.0,而不是2.x或2.1,则spread operator将不起作用,而您必须使用Array.concat

© www.soinside.com 2019 - 2024. All rights reserved.