Alteryx Designer Desktop Discussions

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

Regex

geeksqaud
8 - Asteroid

Hi Friends,

 

I am new to regex and I am trying to extract 3 letter station codes from a given string like the one below.

 

I want to extract only stations that are in the middle of the string not in the beginning or ending??

 

 

DFW,Tom branson,0621905,Tom.branson@saansa.com,Positioning for ride home/there/etc. ,10/16/2018,345,SFO,ORD,B737,Compliant,Not observed,Compliant,Not observed,TEAM WAS WELCOMING, PROACTIVE, AND GRACIOUS (WHEEL CHAIR CUSTOMER PRECEDED ME),Not observed,Compliant,Compliant,Compliant,Compliant,Compliant,Compliant,CONTINUOUS WALK THROUGHS - GREAT COORDINATION WITH GROUND STAFF AND COCKPIT,Compliant,Compliant,CONTINUOUS WALK THRUS/ GREAT EYE CONTACT/ GREAT CREW COORDINATION,FA 3,CHARLIE CROOM ,339057,Compliant,Compliant,Compliant,Compliant,Compliant,Compliant,FROM THE FIRST MEETING AT THE BOARDING DOOR TO OUR VISIT IN THE GALLEY,MIA

 

Thanks,Gs

7 REPLIES 7
BretCarr
10 - Fireball

Do you have anymore data to provide? I’m not sure what is making up your capture/extraction. Are they always together with the commas?

 

I’ll assume so. Use this regex and it’ll nab what you have highlighted. If there’s more variances, we’ll need more data.

 

\,([A-Z]{3})\,([A-Z]{3})\,

That will parse what you have in bold.

Qiu
20 - Arcturus
20 - Arcturus

@geeksqaud 

I think someone may do it better with RegEx

13.PNG

geeksqaud
8 - Asteroid

Thanks a lot. 

 

 

 

in the same Example, how do I parse from date to aircraft type 0/16/2018,345,SFO,ORD,B737,

 

DFW,Tom branson,0621905,Tom.branson@saansa.com,Positioning for ride home/there/etc. ,10/16/2018,345,SFO,ORD,B737,Compliant,Not observed,Compliant,Not observed,TEAM WAS WELCOMING, PROACTIVE, AND GRACIOUS (WHEEL CHAIR CUSTOMER PRECEDED ME),Not observed,Compliant,Compliant,Compliant,Compliant,Compliant,Compliant,CONTINUOUS WALK THROUGHS - GREAT COORDINATION WITH GROUND STAFF AND COCKPIT,Compliant,Compliant,CONTINUOUS WALK THRUS/ GREAT EYE CONTACT/ GREAT CREW COORDINATION,FA 3,CHARLIE CROOM ,339057,Compliant,Compliant,Compliant,Compliant,Compliant,Compliant,FROM THE FIRST MEETING AT THE BOARDING DOOR TO OUR VISIT IN THE GALLEY,MIA

Qiu
20 - Arcturus
20 - Arcturus

@geeksqaud 

For aircraft type, you have some certain pattern?

geeksqaud
8 - Asteroid

Can I get just Date, number, Origin and Destination

 

10/16/2018,345,SFO,ORD ??

Qiu
20 - Arcturus
20 - Arcturus

@geeksqaud 

How about this one.

14.PNG

BretCarr
10 - Fireball

This expression should get you everything but the aircraft type (I labeled the group captures for you to make any tweaks and read easier):

 

(?<date>\d+\/\d+\/\d+)\,(?<number>\d+)\,(?<origin>[A-Z]{3})\,(?<destination>[A-Z]{3})

 

Is the aircraft type always following the airport codes? As long as there aren’t any symbols, this should work:

 

(?<date>\d+\/\d+\/\d+)\,(?<number>\d+)\,(?<origin>[A-Z]{3})\,(?<destination>[A-Z]{3})\,(?<aircraft>\w+)

 

Labels