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

Extract text and number of a specific length from string field with different lengths

bleu
8 - Asteroid

Hi,

 

Read a lot of posts about extracting/ parsing but I can't find one for this problem:

 

Input

202 - Apples 56 - Left
7 - Apples 71
158 - Apples 71
333 - VES Apples 37 Right
313 - RPT Apples 42 Left Basket
195 - Apples 22- PCK

 

Desired output- Just Apples and 2 digit number

Apples 56
Apples 71
Apples 71
Apples 37
Apples 42
Apples 22

 

Any help would be appreciated. Thank you

4 REPLIES 4
binuacs
21 - Polaris

@bleu One method of dong this

REGEX_Replace([Input], '.*(Apples)\s(\d+).*', '$1 $2')

binuacs_0-1647530616145.png

 

bleu
8 - Asteroid

Hi binuacs,

 

I'm not sure why I keep getting the beginning numbers though. Do I need something in REGEX to remove them?

binuacs
21 - Polaris

@bleu Can you share your Regex_Formula here ?

bleu
8 - Asteroid

Never mind.

My fields have different names, I used this as an example. I needed to replace "Apples" with the actual data. Duh!

Thank you so much!! It works 😁

 

Labels