我目前正试图为Google标记管理器服务器端开发一个自定义客户端模板,并希望对特定的URL模式做出反应。不幸的是,我要么对regex感到很傻,要么就是沙箱JS出了问题。我简化了这个例子。开头的反斜杠有个问题。这是代码和错误消息。有谁有主意吗?
const claimRequest = require('claimRequest');
let text = "/abc";
let pattern = /\/ab[c]/;
let result = pattern.test(text);
claimRequest();以及错误消息:
1 Error(s) parsing the input:
token recognition error at: '\'
Offending token '' at 4,15.发布于 2022-07-04 14:23:20
由于这是一个沙箱限制的javascript环境,其中没有包含RegExp构造函数,因此我也无法执行这个基本且非常常见的任务,即分割每个国家的模板。在我看来是个很大的限制。以下是自定义模板中支持的js的完整列表,而RegExp不存在。希望他们将来能加入:https://developers.google.com/tag-platform/tag-manager/templates/standard-library
https://stackoverflow.com/questions/70805322
复制相似问题