ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now
The Alteryx Community will be temporarily unavailable for a time due to scheduled maintenance on Thursday, April 22nd. Please plan accordingly.

Alteryx Designer Discussions

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

REGEX Question

Karl_Spratt
8 - Asteroid

Hi Community,

 

I had another issue earlier and was advised to use REGEX, and honestly I'm only very, very basic on this, 

I've looked at some YouTube videos to try to learn, and I've found a funny issue, I'm using data I get form people via email, where in excel I'd use a text to columns etc. 

 

Picture below is me trying to use Regex to parse out the data, but when one Item is longer than our usual 8 digits, it's jumping over to the Sales Order Number 

We have Item Number's ranging from 3 to 15 characters (Alpha/ Numeric now a days) just to make life more difficult .

Anyway in this example more are 8 digits, but 1 is 11 characters (Alpha/ Numeric) so I'd like to understand how to build the Regex logic using this sample data, to parse all the lines correctly.

Sample Workflow You can see my bad attempt at Regex, and the sample  data in a Notepad format. 

 

I'd like in the end to see the Item Number, the Sales Order No, the current Qty, and the new (Reduced Qty) so I can learn

TIA 

Karl. 

Capture.PNG

apathetichell
11 - Bolide

You have your parse hardcoded for 8 digits - you can change it to any number of word characters (alphanumeric) which come before a space by starting it with:

 

(\w+)\s

 

That should extract the Sales Order Number...

MarqueeCrew
19 - Altair
19 - Altair

@Karl_Spratt 

 

Would Getword([field1],6) suffice?

 

 Cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
messi007
13 - Pulsar

@Karl_Spratt,

 

In you're case you have to find the correct pattern to split the field:

 

messi007_0-1614275130146.png

Hope this helps,

Attached the workflow,

Regards,

Karl_Spratt
8 - Asteroid

Hi Messi007,

That works except for Item Number 24073256UCV it's dropping the (UCV) part of the item number.

What would you do in these  situations 

Field_1ItemSales Order NOCurrent QTYNew QTY
24073256UCV need to reduce in SO 23584456 from 29 to 2524073256235844562925

 

Regards,

Karl. 

messi007
13 - Pulsar

@Karl_Spratt,

 

In this case you add an Or (|) condition

 

messi007_0-1614278153894.png

 

Attached the workflow,

 

Regards,

Karl_Spratt
8 - Asteroid

Thanks Messi007, that's amazing man...

Love to know how to do this 

 

but I'II keep trying, 

also thanks to everyone else you gave solutions. 

 

Cheers,

Karl. 

messi007
13 - Pulsar

@Karl_Spratt,

 

Happy to help man 🙂 & happy analyzing.

 

Best regards,

Labels