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

Conditional Parsing in Alteryx

ghtill
7 - Meteor

Hello I am looking for help and resources on parsing with regex or other tools. Basically I have two different types of string fields with important information I would like to extract. 

 

Current:

Description
1/8 - 1/24/2022 charge for room TAYA-0521-A1 for 1/8/2022-1/24/2022 (16 night(s)) @ $4,911.00/p/120 Night Session
1/8 - 5/8/2022 charge for room VBGA-0641-B1 for 120 night(s) @ $2,511.00/p/120 Night Session

 

Expected:

Date RangeRoomUsedPriceEmpty
1/8 - 1/24/2022TAYA-0521-A116$4,911.00104
1/8 - 5/8/2022VBGA-0641-B1120$5,211.000

 

6 REPLIES 6
IraWatt
17 - Castor
17 - Castor

Hey @ghtill,

There is a lot to unpack in my solution. Essentially I used a few regex expressions to identify the text patterns you want:

IraWatt_0-1662632670399.png

If you want to learn more about Regex the community has some really quick interactive videos on getting to grips with it here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Parsing%20...

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

Emmanuel_G
13 - Pulsar

Hi @ghtill ,

 

Find attached a way of doing this with Regex.

 

Let me know if there is any issue.

 

Emmanuel_G_0-1662644646391.png

 

IraWatt
17 - Castor
17 - Castor

@Emmanuel_G now that is an impressive regex solution 😮!

Emmanuel_G
13 - Pulsar

@IraWatt Thank you dude !

 

I think the flaw of this regex is that I find it sticks too much to the data of the two lines.

 

If we had an entire dataset, I think it would generalize better, but that's actually not bad. 🙂

ghtill
7 - Meteor

@Emmanuel_G and @IraWatt Your solutions and regex resources helped me understand this process better. Thank you! 

IraWatt
17 - Castor
17 - Castor

No worries @ghtill 😄 have a good weekend!

Labels
Top Solution Authors