Alteryx Designer Desktop Discussions

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

need help to extract string after second last special character

abhijeet_86
7 - Meteor

string has the below values as example cannot use find as the characters keep changing but the format remain same

First

  //file:/abc/xyz/zyx/hcdff/ nsledf/abcde

  //file:/abc/xyz/zyx/hcdff/ nsledf/abcde/

 

I need to extract in both the scenario abcde value

9 REPLIES 9
ShankerV
17 - Castor

hi @abhijeet_86 

 

Please find the below expected solution.

 

Input:

ShankerV_1-1671695295222.png

 

Output:

 

ShankerV_0-1671695277320.png

 

If this helps, please like this post and mark it as a solution. If you have any other questions, please let us know.

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @abhijeet_86 

 

Step 1; Input tool

ShankerV_0-1671695385047.png

 

step 2: Formula tool

 

if (Right([Field1],1)="/")
then Left([Field1],length([Field1])-1)
else [Field1]
endif

 

ShankerV_1-1671695402473.png

 

Step 3: Regex tool

 

(\w*)$

ShankerV_2-1671695439234.png

 

If this helps, please like this post and mark it as a solution. If you have any other questions, please let us know.

 

Many thanks

Shanker V

 

 

abhijeet_86
7 - Meteor

Hi @ShankerV 

 

It is not working at my end

KrishnaChithrathil
11 - Bolide

@abhijeet_86 

How about this?

KrishnaChithrathil_1-1671698109902.png

 

abhijeet_86
7 - Meteor

thing is that it is string has a value

 

file://abc.dfg.com/byx/kht/rtioop-reports-fhgjhjh/fkdkjsfks/Region Product Trading Report - Daily

 

while applying your formula value i am getting is  Daily whereas the expected value is

 

Region Product Trading Report - Daily

 

abhijeet_86
7 - Meteor

Hi @KrishnaChithrathil  it is good however it gives me issue

 

when last character of string is /abcde fgh/

it only capture abcde, here i need abcde fgh

 

it does work for /abcde_fgh/

it give value as abcde_fgh

grazitti_sapna
17 - Castor

@abhijeet_86 , You will have to use regex for this. This is how it will work. Please accept my solution it if was useful to you.

 

grazitti_sapna_1-1671699148080.png

 

 

Sapna Gupta
DataNath
17 - Castor

Hi @abhijeet_86, you should be able to tackle this without any RegEx or more complex formulae:

 

DataNath_0-1671699693112.png

 

TrimRight() will remove any trailing '/' which would otherwise throw off the FileGetFileName() function.

The FileGetFileName() function is designed to return file names from paths which it looks like is the case here?

KrishnaChithrathil
11 - Bolide

@abhijeet_86 

This looks little ugly, but does the work. 😀

Input:

KrishnaChithrathil_0-1671700975644.png

 

Output:

KrishnaChithrathil_1-1671701036227.png

 

 

Labels