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

Alteryx Designer Desktop Discussions

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

Trying to Expand RegEx Knowledge for Data Parsing

CTubbs
6 - Meteoroid

Fellow Alteryx-ers,

I've been venturing out in the RegEx world more lately because I've run into some instances in my new role where it could be SUPER helpful with data cleanse/prep. I have a list of attributes (size and quantity) that I am trying to split up, but the values aren't always consistent...enter RegEx.

 

I've attached a little module with sample data I am working with. I will be the first to admit that the current expression is likely way more complicated than it needs to be, I was just using the "or" functions as I did some trial/error. My goal is to capture everything to the left of the 1st letter(s) in 1 new field and the everything else in a 2nd new field.

 

Here is an example of my current results:

Capture.JPG

 

 

 

 

 

Most of them are good to go...but I am not sure why I get some 2 decimal numbers and not others, and I can't seem to figure out how to handle for the hyphenated values.

 

Any help/guidance would be greatly appreciated!

5 REPLIES 5
fmvizcaino
17 - Castor
17 - Castor

Hi @CTubbs ,

 

I'm attaching here an example showing how to get the values you need.

The only question is related to line 7, not sure if you want the 1 PK or 128 OZ

 

Best,

Fernando Vizcaino

RishiK
Alteryx
Alteryx

@CTubbs my go-to regex expert @rahmed may be able to help here 😉

DavidP
17 - Castor
17 - Castor

How about this?

 

([^[:alpha:]]+[[:alpha:]]+)(.*)

CTubbs
6 - Meteoroid

@fmvizcaino That works! Thanks for sharing that.

 

I see what you did with the "[...]" to capture the additional combinations. And as for that 1PK v 128 OZ piece, that is something I was going to error handle for prior to parsing so I will end up with the right data in the right fields. Thanks again.

CTubbs
6 - Meteoroid

@DavidP that also worked! I just tweaked it so the 2nd field didn't have spaces - ([^[:alpha:]]+[[:alpha:]]+)\s(.*)

 

Appreciate the feedback!

Labels
Top Solution Authors