简体   繁体   English

GA 不支持正则表达式

[英]GA does not support RegEx

I am using the following RegEx (check on different RegEx checkers online, on which it works):我正在使用以下正则表达式(在线检查不同的正则表达式检查器,它适用于它):

^((?!pro).)*$

However, GA gives me an error: Invalid regular expression Your data request includes an invalid regular expression.但是,GA 给了我一个错误:无效的正则表达式您的数据请求包含无效的正则表达式。

The line I am trying to exclude is: xx-pro-xxx-xxx我试图排除的行是: xx-pro-xxx-xxx

I have read through the documentation Google provides, but cannot seem to find why it is not working.我已通读 Google 提供的文档,但似乎无法找到它不起作用的原因。

Does anybody know what the problem is and how to solve it?有谁知道问题是什么以及如何解决它?

GA doesn't seem to support lookeheads ( (?!...) ), so you can't use that regex. GA 似乎不支持前瞻(?!...) ),因此您不能使用该正则表达式。 Maybe there is a way to use .{2}-pro-.{3}-.{2} in a negative condition, ie "don't use strings that match this pattern"?也许有一种方法可以在否定条件下使用.{2}-pro-.{3}-.{2} ,即“不使用与此模式匹配的字符串”?

General advice - every regex engine is different and supports different set of operators.一般建议 - 每个正则表达式引擎都不同,并支持不同的运算符集。 It's not enough to check regex on other engines在其他引擎上检查正则表达式是不够的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM