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

Re: regex question

Expand Messages
  • Eric Arnold
    ... Real close. Turns out I think I want: / / but it doesn t seem to recognize {1,} and without the
    Message 1 of 16 , Jun 1, 2006
      On 6/1/06, Benji Fisher <benji@...> wrote:
      > On Thu, Jun 01, 2006 at 05:05:00AM -0600, Eric Arnold wrote:
      > > Sorry if I've got brain lock on this, but is it possible to match a
      > > substring like
      > >
      > > match wildmenu ;\(directory\)\{3,};
      > >
      > > such that it will match three or more substring chars of the pattern
      > > to match "dir" as well as "directory"? (I know the above format isn't
      > > this.) I know I could do it if I could use an expression, but syntax
      > > highlighting doesn't allow that, so I'm wondering if I can do it with
      > > regex alone.
      >
      > Do you mean like /\<dir\%[ectory]/ ?
      >
      > :help /\%[]
      >
      > HTH --Benji Fisher
      >

      Real close. Turns out I think I want:

      /\<\%[directory]\{1,}\>/

      but it doesn't seem to recognize \{1,} and without the \< it seems to
      be matching white space. The problem with \< is that it doesn't
      seem to allow \<\%[.directory]

      What I'm actually trying to do is walk through a list of displayed
      files, highlighting each file individually (full length) (I.e via
      <TAB> key). The regex is because the file names are truncated to a
      given length, and the remainder is wrapped down onto the next column


      ./ >8.3 >oaded
      ../ TabLineSet.vim.2.0 WinWalker.zip.upl>
      TabLineSet.vim.1.> WinWalker.1.2.1.zip >oaded2
      >7.1.vim WinWalker.1.2.zip doc/
      TabLineSet.vim.1.8 WinWalker.2.0.zip plugin/
      TabLineSet.vim.1.> WinWalker.2.1.zip
      >8.1 WinWalker.2.2.zip
      TabLineSet.vim.1.> WinWalker.zip.upl>

      After I solve the \%[ problem, I then have to see if I can deal with
      the continuation segments.....
    • Eric Arnold
      Sorry I wasn t clear, I wanted it to match any substring of directory . I think %[] does this (courtesy of Benji).
      Message 2 of 16 , Jun 1, 2006
        Sorry I wasn't clear, I wanted it to match any substring of
        'directory'. I think \%[] does this (courtesy of Benji).


        On 6/1/06, Cory Echols <ctechols@...> wrote:
        > On 6/1/06, Eric Arnold <eric.p.arnold@...> wrote:
        > > Sorry if I've got brain lock on this, but is it possible to match a
        > > substring like
        > >
        > > match wildmenu ;\(directory\)\{3,};
        > >
        > > such that it will match three or more substring chars of the pattern
        > > to match "dir" as well as "directory"? (I know the above format isn't
        > > this.) I know I could do it if I could use an expression, but syntax
        > > highlighting doesn't allow that, so I'm wondering if I can do it with
        > > regex alone.
        > >
        >
        > Enclose "ectory" in another group that matches zero or one times. The
        > "\v" enables "very magic" mode, and the "%()" construct causes the
        > group to not be counted as a sub-expression:
        >
        > \v(dir%(ectory)?)
        >
      • Charles E Campbell Jr
        ... I suspect you want / /
        Message 3 of 16 , Jun 6, 2006
          Eric Arnold wrote:

          > Real close. Turns out I think I want:
          >
          > /\<\%[directory]\{1,}\>/


          I suspect you want
          /\<d\%[irectory]\>/

          >
          > but it doesn't seem to recognize \{1,} and without the \< it seems to
          > be matching white space. The problem with \< is that it doesn't
          > seem to allow \<\%[.directory]
          >
          > What I'm actually trying to do is walk through a list of displayed
          > files, highlighting each file individually (full length) (I.e via
          > <TAB> key). The regex is because the file names are truncated to a
          > given length, and the remainder is wrapped down onto the next column
          >
          >
          > ./ >8.3 >oaded
          > ../ TabLineSet.vim.2.0 WinWalker.zip.upl>
          > TabLineSet.vim.1.> WinWalker.1.2.1.zip >oaded2
          > >7.1.vim WinWalker.1.2.zip doc/
          > TabLineSet.vim.1.8 WinWalker.2.0.zip plugin/
          > TabLineSet.vim.1.> WinWalker.2.1.zip
          > >8.1 WinWalker.2.2.zip
          > TabLineSet.vim.1.> WinWalker.zip.upl>
          >
          > After I solve the \%[ problem, I then have to see if I can deal with
          > the continuation segments.....
          >
        • Charles E Campbell Jr
          ... I suspect you want / / Regards, Chip Campbell
          Message 4 of 16 , Jun 6, 2006
            Eric Arnold wrote:

            > Real close. Turns out I think I want:
            >
            > /\<\%[directory]\{1,}\>/


            I suspect you want
            /\<d\%[irectory]\>/

            Regards,
            Chip Campbell
          Your message has been successfully submitted and would be delivered to recipients shortly.