Alteryx Designer Desktop Discussions

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

Text to columns, separate everything after the 4th "\" from a string

wonka1234
10 - Fireball

Hi,

 

Is there a way I can separate everything after the 4th "\" from a string?

 

Ie.  O:\Alteryx\community\2023\nov\20\test would become O:\Alteryx\community\2023\nov ?

 

Thanks

6 REPLIES 6
ShankerV
17 - Castor

Hi @wonka1234 

 

Yes, Regex is the best tool to achieve it.

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @wonka1234 

 

Another way of doing this, 

 

Input:

 

ShankerV_0-1669045586192.png

 

 

Output:

 

ShankerV_1-1669045602072.png

 

Shanker V

 

gautiergodard
13 - Pulsar

Hey @wonka1234 

Here is one simple way to achieve this:

gautiergodard_0-1669045608328.png

 

ShankerV
17 - Castor

Hi @wonka1234 

 

Step 1: Input tool

Step 2: Text to columns tool

 

ShankerV_0-1669045673312.png

 

Step 3:

[1]+'\'+[2]+'\'+[3]+'\'+[4]+'\'+[5]

 

ShankerV_1-1669045692136.png

 

Step 4: 

 

ShankerV_2-1669045721455.png

 

Output:

 

ShankerV_3-1669045734016.png

 

Many thanks

Shanker V

 

 

ShankerV
17 - Castor

@wonka1234 

 

Hope my solution worked for you!!!

 

Many thanks

Shanker V

 

 

DataNath
17 - Castor

Hey @wonka1234 here's one possibility with RegEx that will take everything up until the 5th slash:

 

DataNath_0-1669047325386.png

 

((?:[^\\]+[\\]){1,4}[^\\]+)
Labels