Monday, August 31, 2009

Re: globpath with an expression

On Aug 31, 6:33 am, David Fishburn <dfishburn....@gmail.com> wrote:
> Vim 7.2.1-255
>
> Not quite getting something.
>
> I can do this:
> echo globpath('C:\temp', 'test')
> -- Nothing
>
> echo globpath('C:\temp', 'test.*')
> c:\temp\test.db
> c:\temp\test.js
> c:\temp\test.log
> c:\temp\test.vim
>
> echo globpath('C:\temp', 'test\(.*\)')
> c:\temp\test.db
> c:\temp\test.js
> c:\temp\test.log
> c:\temp\test.vim
>
> echo globpath('C:\temp', 'test\(.vim\)')
> -- Nothing
>
> So, I am trying to use a regular expression to start limiting the files.
> Any ideas on what I am missing?

David,
The globpath function does not take a regular expression, but rather a
glob pattern, such as would be accepted by glob(). To see what
metacharacters are significant...
:help wildcard

I'm not sure why the \( \) construct is accepted. Note, however, that
the `.' in your examples is matching a literal `.', not "any
character" as it would in a regex. This being the case, I would expect
'test\(.vim\)' and 'test\(.*\)' to pass or fail together, but I'm
thinking that \( \) may be taking advantage of some undocumented
behavior. Perhaps I've just overlooked something in the documentation.

Brett S.

>
> TIA,
> Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: