-1

In google data studio I would like to make a REGEXP_EXTRACT for getting the string after the first | symbol (https://regex101.com/r/w3BqW4/2). I've tried the regex:

[|].*?$

but this is returning:

' | Leren afzaklaarzen Elisio | kalk'

So I still need to lose the first ' | '. Can anyone help me?

Example:

Input: Toral | Leren afzaklaarzen Elisio | kalk

Output: Leren afzaklaarzen Elisio | kalk

logi-kal
  • 7,107
  • 6
  • 31
  • 43
Sam
  • 13
  • 2

2 Answers2

1

Adding a capturing group () to the initial RegEx does the trick:

REGEXP_EXTRACT(Field, "[|](.*)?$")

Adding the suggestion by cricket_007 "You cannot have "zero or one" of "zero or more" characters":

REGEXP_EXTRACT(Field, "[|](.*)$")

Google Data Studio Report to demonstrate:

2]

Nimantha
  • 6,405
  • 6
  • 28
  • 69
0

If you want to capture every character after the first vertical bar, that would look like this

\\|(.*)$

You don't need question mark after a .*

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245