Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Regex - extracting text after multiple words

RogerA
8 - Asteroid

Hello, i'm new to regex and been reading a lot of forum posts trying to figure out what i need to do with no luck.  I'm sure this is so simple so apologies in advance!

 

I want to extract all words after several different identifiers in the data, so example data would be something like:

 

Supplier Shop XY Green Cat

Customer XY Blue Dog

Supplier AB Pink Snake

Wholesaler GH Black Frog

 

How can i use regex to parse all the text after XY, AB,GH ?  I can do this individually by using XY +(.*) but how can i write it so that i can search on these multiple values?

 

 

11 REPLIES 11
RogerA
8 - Asteroid

Thanks @vishwa_0308 i just tried it but i get an error "an attempt to repeat something that cannot be repeated - for example a*+ at character 0"

vishwa_0308
11 - Bolide

these are the inputs on which i have tried the same expression

 

Supplier Shop XY Green Cat
Customer XY Blue Dog
Supplier AB Pink Snake
Wholesaler GH Black Frog
EF1234 Pluto ABC Planet six
EF2345 Mars ABC Chocolate flavour
F-Type Jaguar DEF Animal jungle
A-Type Mercedes A70 Car types 2
DF-Class Casserole MK2 Dinner time tonight

 

 

Regex Parse= .*\s\w{2}\s(.*)|.*\s[A-Z]\d{2}\s(.*)|.*\s\w{3}\s(.*)

 

Results:

Field1RegexOut1RegexOut2RegexOut3
Supplier Shop XY Green CatGreen Cat  
Customer XY Blue DogBlue Dog  
Supplier AB Pink SnakePink Snake  
Wholesaler GH Black FrogBlack Frog  
EF1234 Pluto ABC Planet six  Planet six
EF2345 Mars ABC Chocolate flavour  Chocolate flavour
F-Type Jaguar DEF Animal jungle  Animal jungle
A-Type Mercedes A70 Car types 2 Car types 2 
DF-Class Casserole MK2 Dinner time tonight  Dinner time tonight
Labels
Top Solution Authors