Thursday, February 17, 2011

matchstr() question.

Hi, all.

I'm trying to build a function that separates file names from full paths. I
was using matchstr() function but there is a problem. It doesn't return
anything. For example:

:echo matchstr("~/.vim/atpl/class.h", "/\w\+\.h$")

Doesn't print anything but:

:echo matchstr("~/.vim/atpl/class.h", "/class\.h")

Does print '/class.h' in the command line. What is wrong with that first
regular expression? For testing it I tried the find command:

/\/\w\+\.h$

And it worked fine searching for a text in a buffer. But I don't understand
why the expression doesn't work in the matchstr() function.

I use MacVim 7.3.

Regards,
Alessandro Antonello

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: