1

I'm trying to build a new calculated field in Google Data Studio to get rid of all the queries. I've tried the following formula:

REGEXP_REPLACE(page,"\?(.*)","")

But Data Studio return me an invalid formula... I guess that's because It's not Google RE2. how do I translate this into Google RE2?

logi-kal
  • 7,107
  • 6
  • 31
  • 43
Simon Breton
  • 2,638
  • 7
  • 50
  • 105
  • 1
    Try double escaping `?`. The regex itself is a valid RE2 pattern. It would be helpful if you also provided some sample string and expected result. – Wiktor Stribiżew Aug 29 '17 at 09:17

1 Answers1

2

You may use

REGEXP_REPLACE(page,"[?].*","")

The pattern will be parsed as a literal ? followed with any 0+ chars, and the whole match will get replaced with an empty string.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563