I am getting "Error: 400 badRequest Invalid regular expression. Regular expressions should follow RE2 syntax." when using regex with pipes

715 views
Skip to first unread message

Alejandro Pinilla

unread,
May 21, 2014, 9:16:25 AM5/21/14
to automate...@googlegroups.com
Hi, 

Last we we started getting an error in some cells where we use filters containing regular expressions. The specific error is:

"Error: 400 badRequest Invalid regular expression: '/(en'. Regular expressions should follow RE2 syntax."  

In this case, a pipe follows "/(en" in the regex used on the filter. It happens in filters with regex containing pipes specially when used with the pagePath dimension. We have been using the files with the same filters for more than 8 months without this problem and only started getting it last week.

Does anyone know how to solve this?

Thanks,

Alejandro

Mikael Thuneberg

unread,
May 21, 2014, 9:48:53 AM5/21/14
to automate...@googlegroups.com
Does your query work at http://ga-dev-tools.appspot.com/explorer/? And if so, what exactly is the regex?

Mikael Thuneberg

unread,
May 21, 2014, 10:26:02 AM5/21/14
to automate...@googlegroups.com
I think we found the reason, it was a bug affecting dynamic GA segment expressions with regexes containing pipes. It should now work again.

Alejandro Pinilla

unread,
May 21, 2014, 12:03:44 PM5/21/14
to automate...@googlegroups.com
It is working once again Mikael.

Thanks for the quick fix!
Alejandro

lm...@converteo.com

unread,
Jun 5, 2014, 10:37:32 AM6/5/14
to automate...@googlegroups.com
Hi,

I still have the issue for queries like the following :

=Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"ga:pagePath=~a(b|c)")

I have the same error as Alejandro since a few weeks :

Error: 400 badRequest Invalid regular expression: 'a(b'. Regular expressions should follow RE2 syntax.

It happens every time I use pipes and parenthesis.

Could you help me on this ?

Thanks,

lm...@converteo.com

unread,
Jun 9, 2014, 11:30:52 AM6/9/14
to automate...@googlegroups.com
Hi Mikael,

Sorry to double post, but the issue described is still there for me, maybe in some circumstances / config the bug you identified after helping Alejandro is still relevant ?

Thanks,

Mikael Thuneberg

unread,
Jun 9, 2014, 2:38:38 PM6/9/14
to automate...@googlegroups.com
Thanks for reporting this, we will address this issue soon.


--
You received this message because you are subscribed to the Google Groups "Supermetrics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automateanalyt...@googlegroups.com.
Visit this group at http://groups.google.com/group/automateanalytics.
To view this discussion on the web visit https://groups.google.com/d/msgid/automateanalytics/6b5cfc02-985e-42dc-aafe-0bc02c561c2a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

James Eckhardt

unread,
Jun 13, 2014, 12:56:13 PM6/13/14
to automate...@googlegroups.com
Can you kindly confirm if this was fixed? (advanced segments using regex & pipes)

I'm getting the same error message using multiple regex with pipes that are combined using the OR Operator (i.e. ,).

Mikael Thuneberg

unread,
Jun 13, 2014, 2:09:14 PM6/13/14
to automate...@googlegroups.com
What's your segment exactly? Note that you should follow the syntax specified at https://developers.google.com/analytics/devguides/reporting/core/v3/reference#segment, meaning for dynamic segments it should start with "dynamic::", "users::" or "sessions::"


--
You received this message because you are subscribed to the Google Groups "Supermetrics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automateanalyt...@googlegroups.com.
Visit this group at http://groups.google.com/group/automateanalytics.

lm...@converteo.com

unread,
Jun 17, 2014, 12:27:53 PM6/17/14
to automate...@googlegroups.com
Hello Mikael, James,

@ Mikael ; yes, you found it ; adding "dynamic::" works. But trying "users::" or "sessions::" fails (Error 400 InvalidParameter).

To sum this up :
  • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"ga:pagePath=~ab") works
  • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"ga:pagePath=~a(b|c)") gives Error: 400 badRequest Invalid regular expression: 'a(b'. Regular expressions should follow RE2 syntax
  • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c)") works
  • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"sessions::ga:pagePath=~a(b|c)") gives Error: 400 invalidParameter Invalid value 'sessions::ga:pagePath=~/a(b|c)' for segment parameter
@ James : It seems Supermetrics allows a little creativity in dimensions as the "dynamic::" is not always mandatory. This is convenient but tricky because, when using Regex pipes and parenthesis, Supermetrics reverts back to being syntax-strict.

To go a bit further, when combining segments with a logical AND (;), please note that you must not repeat the "dynamic::" :
  • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"ga:pagePath=~ab;ga:pagePath=~ef") works
  • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c);dynamic::ga:pagePath=~e(d|f)") gives Error: 400 invalidParameter Invalid value 'dynamic::ga:pagePath=~a(b|c);dynamic::ga:pagePath=~/e(d|f)' for segment parameter
  • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c);ga:pagePath=~e(d|f)") works
But, funny enough, this is the other way around when combining segments with a logical OR (,) :
  • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c),dynamic::ga:pagePath=~e(d|f)") works
  • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c),ga:pagePath=~e(d|f)") gives Error: 400 badRequest Invalid regular expression: '/e(d'. Regular expressions should follow RE2 syntax
I am not sure this the logical way for the GA API to process logical combinations, or if this may be an issue in Supermetrics Regex.

Anyway, this is good to know :-)

Cheers,

Mikael Thuneberg

unread,
Jun 18, 2014, 4:23:13 AM6/18/14
to automate...@googlegroups.com
Thanks a lot for the thorough description of the issue. Based on this, I think we have managed to fix it. Can you confirm it now works for you?


lm...@converteo.com

unread,
Jun 18, 2014, 5:04:11 AM6/18/14
to automate...@googlegroups.com
You are very welcome.

I made some tests this morning, this is what I got :
    • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"ga:pagePath=~ab") works
    • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"ga:pagePath=~a(b|c)") works [changed since yesterday]
    • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c)") works
    • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"sessions::ga:pagePath=~a(b|c)") gives Error: 400 invalidParameter Invalid value 'sessions::ga:pagePath=~/a(b|c)' for segment parameter
      An when combining with AND :
        • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"ga:pagePath=~ab;ga:pagePath=~ef") works
        • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"ga:pagePath=~a(b|c);ga:pagePath=~e(d|f)") works [changed since yesterday]
        • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c);dynamic::ga:pagePath=~e(d|f)") gives Error: 400 invalidParameter Invalid value 'dynamic::ga:pagePath=~a(b|c);dynamic::ga:pagePath=~/e(d|f)' for segment parameter
        • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c);ga:pagePath=~e(d|f)") works
          When combining with OR :
          • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"ga:pagePath=~a(b|c),ga:pagePath=~e(d|f)") works [changed since yesterday]
          • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c),dynamic::ga:pagePath=~e(d|f)") gives Error: 400 invalidParameter Invalid value dynamic::ga:pagePath=~a(b|c),dynamic::ga:pagePath=~e(d|f)' for segment parameter [changed since yesterday]
          • =Supermetrics(***;***;"visits";"01/03/2014";"31/03/2014";;;;"dynamic::ga:pagePath=~a(b|c),ga:pagePath=~e(d|f)") works [changed since yesterday]
          So, since your change :
          1. Supermetrics seems to be more tolerant to missing "dynamic::" syntax when using pipes and parenthesis, even when combining with AND or OR
          2. No change regarding the use of sessions:: or users:: (GA syntax, but I can see why we do not need that with SM)
          3. OR and AND logical combinations behave in the same way ; "dynamic::" needs to be used only once (if one wants to use it at all), on the first segment used
          Thanks,

          Mikael Thuneberg

          unread,
          Jun 18, 2014, 6:02:04 AM6/18/14
          to automate...@googlegroups.com
          Thanks for testing. The remaining errors are coming from Google and we can't fix them. For "sessions::", you have to use something like "sessions::condition::", see https://developers.google.com/analytics/devguides/reporting/core/v3/reference#segment


          Louis-Marie de Langlois

          unread,
          Jun 18, 2014, 6:14:38 AM6/18/14
          to automate...@googlegroups.com
          Ok, thanks Mikael.

          ----
            Louis-Marie de Langloishttp://www.converteo.com/signature-mail/converteo.jpg
            Consultant
             LD : +33 1 84 17 26 20
             Mail : lm...@converteo.com
             Adresse : 3, rue de Montyon - 75009 Paris  



          Reply all
          Reply to author
          Forward
          0 new messages