Community Halloween is live until October 31st! Complete any 2 quick activities to earn the 2025 Community Halloween badge. Feeling brave? Check out the activities here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Parse column

BautistaC888
8 - Asteroid

Hello,
I need to parse to a column, every time a product code appear.
The product codes have this format:
SKU 0726709 ("SKU" + 7 numbers).
Here is an example.
Thank you

5 REPLIES 5
marcusblackhill
12 - Quasar
12 - Quasar

hEY @BautistaC888 !

 

Use a formula tool with this formula below:

IIF(REGEX_Match(REGEX_Replace([Product], ".*(SKU\s*\d+).*", "$1"), "SKU\s*\d+")=-1,REGEX_Replace([Product], ".*(SKU\s*\d+).*", "$1"),Null())

 

Hope that helps!

apathetichell
20 - Arcturus

regex parse mode - (SKU\s\d{7}) matches your  desired output.

apathetichell
20 - Arcturus

Hi @marcusblackhill  - FYI - Regex_Match can return boolean values (despite what you may have heard on an otherwise wonderful Alteryx Academy video on regex) so:

 

IIF(REGEX_Match([Product], ".*SKU\s*\d{7}.*"),REGEX_Replace([Product], ".*(SKU\s*\d{7}).*", "$1"),Null())

 

is the same as yours... no reason for the unwieldy "=-1" part...

marcusblackhill
12 - Quasar
12 - Quasar

Thanks @apathetichell !

 

Actually It's just the custom to work with returns to see better the definition hehehe But yeah, don't really need that part because is boolean already.

HomesickSurfer
12 - Quasar

hi @BautistaC888 

 

If unfamiliar with Regex or if challenging, a tool-based (though less-efficient) approach also works..

 

Capture.PNG

Labels
Top Solution Authors