Regex - extracting text after multiple words
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Silenciar
- Página de impresión sencilla
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
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?
¡Resuelto! Ir a solución.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
^.+\s\u\u\s(.*)$
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
IIf you only want to do this for Specific words, then perhaps some thing like
(^.+)([XP|AB|GH].*$)
Cheers,
Iain
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
Is it possible to account for different lengths of uppercase characters ?
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
^.+\s\u\u+\s(.*)$
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
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.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
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).
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
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.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Notificar al moderador
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
- « Anterior
-
- 1
- 2
- Siguiente »