Free Trial

Alteryx Designer Desktop Discussions

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

Extracting the Last Part of the Filename to Produce 2 Results

KamenRider
11 - Bolide

Guys,

 

I have here a field name where I would like to extract the last part of it. I have tried the Text to Column Tool but it gets it division from the middle. Below is the sample

 

SACLN 2023-1 B

BHASE 2023-CL1 MI

KJDWM 2023-CL1 M2

 

Results should be in 2 parts

 

Column1                     Column2

SACLN 2023-1               B

BHASE 2023-CL1          M1

KJDWM 2023-CL1         M2

 

Hope someone to help me on this.

 

Thanks,

Kamen

 

5 REPLIES 5
DavidSkaife
13 - Pulsar

Hi @KamenRider 

 

As long as your fields are in this format, you can use the Regex tool to parse using the below expression:

 

(\w+\s\d+\-\w+)\s(\w+)$

 

It's a bit blunt but works.

 

First expression between the two brackets looks for 1 or more characters, followed by a space, followed by 1 or more numbers, followed by -, followed by 1 or more characters

Separated out by a space

Second expression between the two brackets looks for 1 or more charcters

$ denotes end of line

binuacs
21 - Polaris

@KamenRider one way of doing this

image.png

KamenRider
11 - Bolide

Hi @binuacs and @DavidSkaife 

 

Both solutions work. Thank you for giving me ideas how to deal this problem. I also like the explanation of @DavidSkaife which gave me information about how it is being done although frankly until now it is really hard for me to understand RegEx. Any way I accepted both solutions. One solution I made was using the TextoColumn together with formula which also works for me.

 

Thanks again.

Kamen

DavidSkaife
13 - Pulsar

Hi @KamenRider 

 

I find that https://regex101.com/ is a pretty good resource in helping you understand Regex code, and allows you to test it against existing strings to see if it's working as expected. Hope that helps you as well!

KamenRider
11 - Bolide

Hi @DavidSkaife 

 

This has been introduced to me however, sad to say I don't understand on how to use this. Can you show some samples or videos on how to start with this?

 

Thanks again for your ideas.

 

Kamen

Labels
Top Solution Authors