Alteryx Designer Desktop Discussions

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

Regex to parse out two pieces of information.

OscarD
5 - Atom

Long time listener, first time caller here. Typically I can find some great information here on problems I'm trying to solve but I'm stumped with my current one. I have a text field where I'm trying to extract two pieces of information from. This particular field can be up to 109 values long. The first bit of information that I'm trying to retrieve is the particular Cohort grouping and the second piece of information is a network name, such as "Traditional Select" or "Advantage". The issue I have is that the field can have something like "Cohort Cohort B-Preferred Update" and if I use the following expression (Cohort A|Cohort B|Cohort C||Cohort D|Cohort Sample) I get Cohort C as the output because of the duplicated "Cohort Cohort" in the field. Also, how do I then get the second part of the data I need having a combination of spaces and dashes after the cohort name?

 

Below is a sampling of the data, the first column is a field that I have, and the two right columns is what I'm trying to achieve. Of note, the Description field can contains varying names of different lengths, a combination of text and numbers, it doesn't always begin with the string "Cohort".

 

DescriptionCohortNetwork
Cohort A-Advantage (Open 30)Cohort AAdvantage
Cohort A-HMOCohort AHMO
Cohort B - PerformanceCohort BPerformance
Cohort B - Preferred NetworkCohort BPreferred
Cohort B-Advantage (Open 30)Cohort BAdvantage
Cohort B-PerformanceCohort BPerformance
Cohort C-Advantage (Open 30)Cohort CAdvantage
Cohort C-HMOCohort CHMO
Cohort Cohort ACohort A 
Cohort Cohort A-Advantage (Open 30)Cohort AAdvantage
Cohort Cohort BCohort B 
Cohort Cohort B-Advantage (Open 30)Cohort BAdvantage
Cohort Cohort CCohort C 
Cohort Cohort C-Advantage (Open 30)Cohort CAdvantage
Cohort Cohort DCohort D 
Cohort Cohort Sample-PerformanceCohort SamplePerformance
Cohort C-OK-HMOCohort CHMO
Cohort C-Open 90Cohort COpen 90
Cohort D-PerformanceCohort DPerformance
Cohort D-SelectCohort DSelect
Cohort Sample-Advantage (Open 30)Cohort SampleAdvantage

 

Thanks in advance!!

2 REPLIES 2
nagakavyasri
12 - Quasar

Screenshot 2023-06-27 140311.png

OscarD
5 - Atom

Thank you!!! This worked. I really appreciate it.

Labels