Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

How do i extract all data to the right after a specific character

Jdelagu11
5 - Atom

I'm trying to extract all the data from a field after the very last underscore "_" in the data (see below screenshot).

 

So the data highlighted in RED would be the extract. I tried using formulas but nothing seems to work. Can this be done in a formula?

... or does it need to be done in REGEX? If it needs to be done in regex, can someone help me with what the code would like?

Still a beginner with REGEX unfortunately.

 

2024_08_07_August RNR Green FB_A24FN170DAADAAD
2024_08_05_August RNR TS AM FB_A24FN206DAADAAD
2024_08_05_August RNR TS AM_B24FN206DAPDAARR
2024_08_05_August RNR TS AM_A24FN207DANOA
2024_08_05_August RNR TS AM_G24FN206

 

Thanks for any help!  Javier

 

4 REPLIES 4
binuacs
21 - Polaris

@Jdelagu11 one way of doing this

image.png

Jdelagu11
5 - Atom

That worked! Thanks so much for the quick resolution! I'm going to have to start studying what all those characters mean! :)

Jdelagu11
5 - Atom

I used the below code to pull out all the data in RED in a formula tool:

 

REGEX_Replace([FieldName],'.*_(.*)', '$1')

 

2024_08_07_August RNR Green FB_A24FN170DAADAAD
2024_08_05_August RNR TS AM FB_A24FN206DAADAAD
2024_08_05_August RNR TS AM_B24FN206DAPDAARR
2024_08_05_August RNR TS AM_A24FN207DANOA
2024_08_05_August RNR TS AM_G24FN206

 

This worked great but now i need to pull out all the data in red after the character "\". How would i alter regex below to do this?

 

I tried this - but that didn't work:

REGEX_Replace([FieldName],'.*\(.*)', '$1')

 

2024_08_07_August RNR Green FB\A24FN170DAADAAD
2024_08_05_August RNR TS AM FB\A24FN206DAADAAD
2024_08_05_August RNR TS AM\B24FN206DAPDAARR
2024_08_05_August RNR TS AM\A24FN207DANOA
2024_08_05_August RNR TS AM\G24FN206

 

Any thoughts would be greatly appreciated. Thanks.

Jdelagu11
5 - Atom

I'm starting to think the forward slash \ is not allowed in Regex?

Labels