MATLAB: Regexp question (-.- 4 word minimum)

regexp

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 ).

Best Answer

s='055451051 (/document name/folder/file name)'
out=s(max(strfind(s,'/'))+1:end-1)
in the above example the third is the last, if they are more then 3 /. then
s='055451051 (/document name/folder/file name)'
idx=strfind(s,'/')
out=s(idx(3)+1:end-1)