sierra.charli3
sierra.charli3

Reputation: 225

Data studio regex calculated field replace after |

I'm having trouble with the formula to replace page title after |, using \| it just says "Could not parse formula". Can anyone help?

REGEXP_REPLACE(Page Title, '\|(.*)', '')

So Page name | Company name should turn to Page name

Upvotes: 1

Views: 1903

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 627469

I suggest using

REGEXP_REPLACE(Page Title, ' *\\|.*', '')

or

REGEXP_REPLACE(Page Title, ' *[|].*', '')

You need to double the escaping backslashes or put | into a character class, and add a quantified space before to "trim" the value. You don't need the group, so I suggest removing it.

Upvotes: 3

Related Questions