Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

RegEx Parsing Question

Bren312
8 - Asteroid

Hi everyone, I'm hoping someone can help me with a RegEx question.  I've got a field with 'Order #', consisting of the warehouse number (from 1 to 4 digits) separated by a "-"; followed by MMDD; followed by"-"; with three random numbers at the end (Ex. 61-1203-783).

 

I'm trying to parse this into two columns; one with the warehouse number and one with the remaining numbers of the Order # (Ex. Warehouse Field = 61; P.O. Field = 1203783).

 

I've attached a workflow with three containers; the Blue Container (#1 - Incoming Data) has the Order # as it exists; the Orange Container (#2 - Parse Attempt) is my unsuccessful parse attempt; and the
Pink Container (#3 - Desired Output) is the format I'm looking for.  I know this can be done with a Text to Columns or Parse on "-" and combining columns but I'm hoping to do it all in one tidy RegEx.

 

I'm currently running Designer 2020.3.  Thanks everyone!

 

Bren

2 REPLIES 2
mpennington
11 - Bolide

For some reason, I can't open your workflow package.  Regardless, I think this does what you need:

 

REGEX_Replace([Sample],'(\d\d)-(\d{4})-(\d{3})','$1')

 

REGEX_Replace([Sample],'(\d\d)-(\d{4})-(\d{3})','$2$3')

 

RegParse.jpg

Bren312
8 - Asteroid

@mpennington Thanks for the help and I'm sorry you weren't able to open the workflow (I haven't posted a yxzp since my last update so I may have missed a box to check).

 

This solution pretty much works (with a bit of tweaking for the Warehouse; since it's anywhere from 1 - 4 digits) but I was hoping to write it all in one RegEx tool.  The only reason for that is I'm trying to demo some RegEx use cases for training I'm doing.  Thanks again; I appreciate it!

 

Bren

Labels
Top Solution Authors