Loading ...
Sorry, an error occurred while loading the content.

globpath with an expression

Expand Messages
  • David Fishburn
    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
    Message 1 of 3 , Aug 31, 2009
    • 0 Attachment
      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?

      TIA,
      Dave

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Brett Stahlman
      ... 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
      Message 2 of 3 , Aug 31, 2009
      • 0 Attachment
        On Aug 31, 6:33 am, David Fishburn <dfishburn....@...> 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
        -~----------~----~----~----~------~----~------~--~---
      • David Fishburn
        On Mon, Aug 31, 2009 at 10:19 AM, Brett Stahlman wrote: ... Thanks Brett. Now I suck everything back with a * and then use a
        Message 3 of 3 , Aug 31, 2009
        • 0 Attachment
          On Mon, Aug 31, 2009 at 10:19 AM, Brett
          Stahlman<brettstahlman@...> wrote:
          ...
          > 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

          Thanks Brett.

          Now I suck everything back with a * and then use a filter() for the
          regex on the list afterwards.

          Dave

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        Your message has been successfully submitted and would be delivered to recipients shortly.