Data Studio
3.2K members online now
3.2K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

Replace part of text using REGEXP_REPLACE

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

How can I replace "State of" on Region using REGEXP_REPLACE?
Example:
State of Rio de Janeiro -> Rio de Janeiro

I've try this formule REGEXP_REPLACE(Região, 'State of', ' '), but doens't work.

Thanks.

Replace part of text using REGEXP_REPLACE

Explorer ✭ ✭ ✭
# 2
Explorer ✭ ✭ ✭

Hi @EFICAZ

 

That looks like it should work just fine, as long as 'Região' is your field name? I built the below to test on my data, it's the same format as your and works fine.

 

REGEXP_REPLACE(Product, 'Trainers', ' ')

 

Hope that helps,

Ben

Replace part of text using REGEXP_REPLACE

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Ben

 

I still have the same problem. The link below contains the formule's image:

https://drive.google.com/file/d/0B22xI_voxKy9aWdoY0pwVnViTXc/view?usp=sharing

 

Please, can you help me?

 

Thanks.

Re: Replace part of text using REGEXP_REPLACE

Explorer ✭ ✭ ✭
# 4
Explorer ✭ ✭ ✭

Hi @EFICAZ

 

I've just taken a look at my calculation and it looks the same as yours - I tried adding a space to see if this caused any issues, but it worked fine (see below)

 

Capture.PNG

 

The only difference I can see that might be worth trying is removing the special text character you have in 'Região' - does replacing the 'ã' with an 'a' make any difference? This is a long shot! Smiley Happy

 

Ben

Replace part of text using REGEXP_REPLACE

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi Ben!

 

The problem is solved. I had not put the calculated field like a dimension. The formule was correct from the beginning but I was not using it. We are only begginer in Data Studio Smiley Tongue.

 

Thank you very much for your attention.

 

Eficaz