Google Tag Manager -Regex Match
我想检查GTM变量中是否包含特定字符串。该变量的值是通过URI进行解码的第一方 - 奇异值:
"\"prodirversion\":5,\"panellanguage\":\"de\",\"preferences\":false,"\"marketing\":true,\"necessary\":true,\"statistics\":false,\"social_"
我现在想检查是否包括以下字符串。
营销”:True
我使用正则表格创建了另一个变量,并尝试了不同的正则表达式,但似乎无效。它在在线REGEX Tester上起作用,但在Google Tag Manager中不起作用。
我的猜测将是以下内容 不起作用
marketing\\":true
。
marketing.{3}true
它
marketing\\.{2}true
I want to check if a specific string is included in a GTM variable. The value of this variable is a first-party-cookie value decoded via URI looking like this:
"\"prodirversion\":5,\"panellanguage\":\"de\",\"preferences\":false,"\"marketing\":true,\"necessary\":true,\"statistics\":false,\"social_"
I now want to check if the following string is included.
marketing":true
I created another variable with a regex table and tried different regex expressions but nothing seems to work. It works on online regex tester but not in Google Tag Manager.
My guess would be the following but it doesn't work.
marketing\\":true
or
marketing.{3}true
or
marketing\\.{2}true
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
某些正则发动机将在不逃脱
“
char inMarketing \ \”中遇到错误:true
尝试这样逃脱:
Marketing> Marketing \\\\':true << /code>,它应该匹配
:
gtm
中工作Some Regex engines will have an error on not escaping
"
char inmarketing\\":true
Try escaping it like this:
marketing\\\":true
, and it should match.Update:
marketing":true
seems to be working inGTM
\
in input string is for show only in GTM case, and should be ignored when regex testing/debugging.