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:
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!
Solved! Go to Solution.
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
How about this?
([^[:alpha:]]+[[:alpha:]]+)(.*)
@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.
@DavidP that also worked! I just tweaked it so the 2nd field didn't have spaces - ([^[:alpha:]]+[[:alpha:]]+)\s(.*)
Appreciate the feedback!