Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Parsing path with regex

shravanvijayaprasad
8 - Asteroid

I have a path C:\1\2\3\4\ but I want to get C:\1\2\3\ 

 

Also, how can I get just 2 or 3 alone separately based on pattern.

 

Again 1, 2, 3 are just examples, want to use a formula tool to get the above. Could someone help me with this? and also explain to me how it works? I would love to understand the logic behind regex_replace.

4 REPLIES 4
grazitti_sapna
17 - Castor

Hi @shravanvijayaprasad  try this.

 

grazitti_sapna_0-1595915041197.png

 

You can do it by parsing the regex depending upon the combinations of word your are using so change the regex accordingly or you can do this using text tol columns tool as well just need to concatinate the fields again.

Thanks

Sapna Gupta
shravanvijayaprasad
8 - Asteroid

@grazitti_sapna thank you so much, the only issue is I can't be sure the path will be like C:\1\2\3\4\ or it could also be C;\1\2\3\4\5\ or C:\1\2\3\4\5\6\ . In these cases, I want it to be dynamic and give the output as C:\1\2\3\ , C;\1\2\3\4\ and C:\1\2\3\4\5\ respectively. Infact, the path could be something like D:\1\2\3\4\ also. 

grazitti_sapna
17 - Castor

Hi @shravanvijayaprasad  give this a try I hope this will work.

 

grazitti_sapna_1-1595930579485.png

 

Sapna Gupta
shravanvijayaprasad
8 - Asteroid

@grazitti_sapna thank you so much! this did work! I also did it using regex_replace in formula tool, just attaching if anyone wants to use it in the future 🙂 

Labels