I am connecting directly to a data source (Google Analytics) in Data Studio. I am using the field "Page Title" which is a text field.
I wish to add a calculated field which capitalizes the first letter of each word in the string of the field "Page Title".
Example:
| Current state | Desired output |
|---|---|
| What to expect from the authorities in 2021 | What To Expect From The Authorities In 2021 |
| Sustainability – An emerging theme | Sustainability – An Emerging Theme |
| Helping UK businesses make confident decisions | Helping UK Businesses Make Confident Decisions |
The first part is easy. I can find the first letter of each word that starts with a lowercase by using
(\b[a-z])
In old PHP I could use the token \u to replace with capital letters
\u$1
BUT when I use this in Google Data Studio like this:
REGEXP_REPLACE(Page Title,"(\b[a-z])","\u$1")
I get an error
Syntax error: Illegal escape sequence: \u must be followed by 4 hex digits but saw: \u).
From what I have researched, it seems that "\u" is not supported in RE2. But I have searched for 4.5hours and I can not find what to use to replace my match with capital letters.
Your help will be greatly appreciated.