regexp question (-.- 4 word minimum)
Mostrar comentarios más antiguos
I have a string thats goes like this:
055451051 (/document name/folder/file name)
I want a simple regexp that will give me the name between the third / to the ). I tried:
regexp(str, '/(?<name>\w*))', 'names')
but it keeps returning a 0x0 struct. I can get it if I use split on the string using '/' as a delimeter. But my file name come out like 'File name)' and has the parentheses on the end. I can get rid of it but I'm thinking that there's an easier way for me to get whats between the / and ).
1 comentario
Sean de Wolski
el 18 de Sept. de 2012
+1 Let's wait until the regexp masters wake up!
Respuesta aceptada
Más respuestas (1)
Matt Tearle
el 18 de Sept. de 2012
I know you've already got it working, but regexp challenges are always fun. This seems to work...
x = regexp(str,'/([\w\s]*?))','tokens')
Match any number of characters and spaces, but only as many as necessary, between a / and a ).
1 comentario
Sean de Wolski
el 18 de Sept. de 2012
regexp challenges always make me feel dumb and inadequate...
Thanks for posting it!
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!