We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Remove everything after the last \

smallpotato
7 - Meteor

Hi, I am a bit confuse from using the regex formula.

I would like to extract the folder path from using the [engine.workflowdirectory] in the muti-field formula tool.

For example, the folder path of the workflow directory is "C:\folder1\folder2\folder3\"

However, what i want "C:\folder1\folder2\folderABC\" instead

I have tried the below formula which I found online, but failed.

REGEX_Replace([engine.workflowdirectory], '\\\\[^\\\\]+$', '')

 

 The number and name of folder are not fix, which means the workflow directory could be "C:\folder5\folder4\folder6\folder1\folder2\folder3\"

But all i want is just remove everything after the second last backslash and replace it by "folderABC\" to "C:\folder5\folder4\folder6\folder1\folder2\folderABC\"

 

could anyone help with this?

2 REPLIES 2
DataNath
17 - Castor
17 - Castor

Hey @smallpotato, you should be able to use the following:

 

REGEX_Replace([Engine.WorkflowDirectory], '(.+\\)[^\\]+\\', '$1')+'folderABC\'
smallpotato
7 - Meteor

thanks for the quick reply. its work for me

Labels
Top Solution Authors