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?
Solved! Go to Solution.
^.+\s\u\u\s(.*)$
IIf you only want to do this for Specific words, then perhaps some thing like
(^.+)([XP|AB|GH].*$)
Cheers,
Iain
^.+\s\u\u+\s(.*)$
I've not managed to get either solution working perfectly, but Ryan's was closest, it didn't' work completely though as it extracts the last word only, but not all words after the uppercase values.
Maybe some more representative data will help show why the above ideas are not working for me, my data has more variance in it so:
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
The items in my bold are common throughout the data and i need to extract everything after those items in bold (there is no formatting in the data - bolded just to highlight above).
I have managed to get it working, but probably not the optimal solution. I did:
ABC(.*)|DEF(.*)|A70(.*)|MK2(.*)
and then after this joined all the outputs using a formula.
Hi @RogerA,
You can parse the below expression hope this will work for all your given strings:
.*\s\w{2}\s(.*)|.*\s[A-Z]\d{2}\s(.*)|.*\s\w{3}\s(.*)
Thanks,
Vishwa