Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Have to extract the country from the file path

Sshasnk
8 - Asteroid

There is list of file path from which I have to extract country name.

 

Example:

File Path
G:\A\AS\Projects\Input\Guam & NMI\Apple.xlsx
G:\A\AS\Projects\Input\Form\Guam & NMI\Apple_1.xlsx
G:\A\AS\Projects\Input\Indonesia\Mango.xlsx
G:\A\Projects\Input\Singapore\Mango.xlsx
G:\A\Projects\Input\Output\Singapore\Mango.xlsx

 

Now the logic should be is to select the data which is between Last \ symbol and second last \ symbol because the number of \ symbol could vary but the country name will always before the last \ symbol

 

Output:

File PathCountry
G:\A\AS\Projects\Input\Guam & NMI\Apple.xlsx Guam & NMI
G:\A\AS\Projects\Input\Form\Guam & NMI\Apple_1.xlsxGuam & NMI
G:\A\AS\Projects\Input\Indonesia\Mango.xlsx

Indonesia

G:\A\Projects\Input\Singapore\Mango.xlsxSingapore
G:\A\Projects\Input\Output\Singapore\Mango.xlsxSingapore

 

 

1 REPLY 1
DataNath
17 - Castor
17 - Castor

Hey @Sshasnk, as long as that pattern is consistent as you say there'll be a few variations that work for this. If you use the RegEx tool in Parse mode with the following expression then this will work:

 

 

.+\\(.+)\\

 

abcabc.png

 

Labels
Top Solution Authors