Community Halloween is live until October 31st! Complete any 2 quick activities to earn the 2025 Community Halloween badge. Feeling brave? Check out the activities here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Replace nth occurrence of value in a string

HomesickSurfer
12 - Quasar

Hello

 

Anyone here know why my Alteryx formula expression isn't working?

Using the following, I intend to replace the 10th semicolon (;) in my strings with a tilde (~).

 

 

Replace([F15], "^(?:(?:[^;]*;){9}[^;]*);", "~")

 

 

Sample strings:
532.00;515;S;N;US80687P1066;20221027;20221031;2;UNT;51.49;Y; ;.15;XPAR;
533.00;515;S;N;US80687P1066;20221027;20221031;23;UNT;592.17;Y; ;1.78;XPAR;

3 REPLIES 3
binu_acs
21 - Polaris

@HomesickSurfer I think you need to use the Regex_Replace() function

 

REGEX_Replace([Sample strings:], '(^(?:(?:[^;]*;){9}[^;]*));', '$1~')

binuacs_0-1674772328414.png

 

BS_THE_ANALYST
15 - Aurora
15 - Aurora

Thank you @binu_acs for your logic. I learned alot from your solution. 👏

BS_THE_ANALYST_1-1674773544231.png

 

 

All the best,
BS

LinkedIN

Bulien
HomesickSurfer
12 - Quasar

Thank you @binu_acs .  This works!!

Labels
Top Solution Authors