Manipulación simple de cadenas Regex
Frecuentes
Visto 47 equipos
0
Just a simple question. I am wondering how to write a regex expression for the phrase 'Ste 5800 Bldg 10 Ste A'.
I would like it to handle both the numeric values and the letter values after the wordphrase. I am just having trouble doing that. I have '\w+\s\d+, but i do not know how to include the letter values.
The end result should be 'Ste 5800','Bldg 10','Ste A'.
2 Respuestas
1
contestado el 28 de mayo de 14 a las 18:05
It does not match the strings he wants - el3ien
yup, I forgot the parenthesis. - CMPS
guys I have another question lol, would you want me to ask here on the comments or on a new question all together? - user3683871
@user3683871 New question please :) - CMPS
1
Esto debería hacer el trabajo.
'Ste 5800','Bldg 10','Ste A'.
\w+\s[\d\w]+
If you want to search for 'Ste A' but not 'Ste Aspect'
\b\w+\s\d+|\b\w+\s\w\b
contestado el 28 de mayo de 14 a las 17:05
Thanks! and what if i wanted to only capture multiple digits and singular letters such that I want the regex to capture 'Ste A' but not "Ste Aspect"? - user3683871
are there allways ' or " at the end or spaces? - el3ien
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas regex string python-3.x or haz tu propia pregunta.
Can you say which letters are fixed ? - CMPS
I think this will answer it. I want to only capture multiple digits and singular letters such that I want the regex to capture 'Ste A' but not "Ste Aspect". Is that good? - user3683871