Question about Formula in Data Studio
I have a problem with a calculated field in Data Studio. I have a field "Campaign", the text is build in "Text1 | Text2_Text3 | Text4 | Text5". I want to extract Text2, so i have a separat field with Text2. I used the formula "Regexp_extract(...)" but it didnt work.
So wanted to ask you. Can you tell me the function for my problem? Thanks a lot.
Re: Question about Formula in Data Studio[ Edited ]
June - last edited June
Given your pattern, try this:
- ^ = start of string
- [^|]+ = first sub-string match anything except a |
- \\| = | has a special meaning in regex (it means "or"), so we need to escape it - usually we need only one \, but for some reason DS insist that we use two... probably because the regex is used as a string before being passed to the real regex engine, so \\| first becomes \| and then is processed
- ([^|]+) = match the second text, up until the next |
That should do it! I tested and it worked