Calling all Alteryx customers: Refer your colleague to try Alteryx and receive a $50 gift card. Sign up now!
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Replacing a char with apostrosphe error

Akeelah
7 - Meteor

Hi
I am unable to replace char with an apostrosphe
Input value = Coquerel's Sifaka

Output = Coquerel''''''s Sifaka

 

Formula = ReplaceChar([Name], "[']" , " ' ") 

3 REPLIES 3
Rhys_Cooper
9 - Comet

Hi Akeelah. I reccomend using the regex tool rather than the formula tool for your use case.

 

The regex expression you need is (?:'). here the "?:" means match everything inclosed.

 

The screenshot below shows the configuration of the tool:

 

Screenshot 2024-05-03 125302.png

 

 

Akeelah
7 - Meteor

Thanks @Rhys_Cooper , this works , I am wondering if there is any workaround using REPLACECHAR

BS_THE_ANALYST
14 - Magnetar
14 - Magnetar

@Akeelah Any issue with just using replace?

Screenshot 2024-05-03 185505.png

 

The mistake you are making is with your logic. If you say replace "MYNAME" with "GRASS". The word "MYNAME" gets replaced with "GRASS". It doesn't replace each letter within "MYNAME" with "GRASS" rather the whole string itself.

 

I like the method I provided above and interesting you can't do "|"*6 and get "||||||" unlike python. Somehow I hacked this with the padleft function though so I'm not complaining. Every day is a school day.

 

All the best,

BS

All the best,
BS

LinkedIN

Bulien
Labels
Top Solution Authors