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

Weird behaviour with /\@<= (Bug?)

Expand Messages
  • Preben Peppe Guldberg
    Using the following pattern: /, @
    Message 1 of 4 , May 26, 2002
    • 0 Attachment
      Using the following pattern:

      /,\@<=[^,]*/

      it is beyond me why it matches the second comma in ",,,,,,,".

      These two, on the other hand, works as I'd expect:

      /,\@<=[^,]/
      /,\@<=[^,]\+/

      I am up to date, I believe, using vim 6.1.81.

      Peppe
      --
      "Before you criticize someone, walk
      Preben "Peppe" Guldberg __/-\__ a mile in his shoes. That way, if
      c928400@... (o o) he gets angry, he'll be a mile away
      ----------------------oOOo (_) oOOo-- - and barefoot." --Sarah Jackson
    • Bram Moolenaar
      ... The * means any number of , in this case a zero count is used. In effect you are matching nothing with a comma before it. ... That s correct. --
      Message 2 of 4 , May 26, 2002
      • 0 Attachment
        Preben Peppe Guldberg wrote:

        > Using the following pattern:
        >
        > /,\@<=[^,]*/
        >
        > it is beyond me why it matches the second comma in ",,,,,,,".

        The "*" means "any number of", in this case a zero count is used.
        In effect you are matching nothing with a comma before it.

        > These two, on the other hand, works as I'd expect:
        >
        > /,\@<=[^,]/
        > /,\@<=[^,]\+/

        That's correct.

        --
        hundred-and-one symptoms of being an internet addict:
        61. Your best friends know your e-mail address, but neither your phone number
        nor the address where you live.

        /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
        /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
        \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
        \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
      • Preben Peppe Guldberg
        ... Get it. That, of course, is the reason why consecutive n s jumps to every comma but the first. Let me rephrase, then. Why is only the second comma
        Message 3 of 4 , May 26, 2002
        • 0 Attachment
          Thus wrote Bram Moolenaar (Bram@...) on [020526]:

          > Preben Peppe Guldberg wrote:

          > > Using the following pattern:

          > > /,\@<=[^,]*/

          > > it is beyond me why it matches the second comma in ",,,,,,,".

          > The "*" means "any number of", in this case a zero count is used.
          > In effect you are matching nothing with a comma before it.

          Get it. That, of course, is the reason why consecutive n's jumps to
          every comma but the first.

          Let me rephrase, then. Why is only the second comma highlighted (I have
          'hlsearch' on)?

          Peppe
          --
          "Before you criticize someone, walk
          Preben "Peppe" Guldberg __/-\__ a mile in his shoes. That way, if
          c928400@... (o o) he gets angry, he'll be a mile away
          ----------------------oOOo (_) oOOo-- - and barefoot." --Sarah Jackson
        • Bram Moolenaar
          ... Good question. I ll have to look at the code to find out. It s probably because of matching an empty string. -- hundred-and-one symptoms of being an
          Message 4 of 4 , May 27, 2002
          • 0 Attachment
            Preben Peppe Guldberg wrote:

            > > > Using the following pattern:
            >
            > > > /,\@<=[^,]*/
            >
            > > > it is beyond me why it matches the second comma in ",,,,,,,".
            >
            > > The "*" means "any number of", in this case a zero count is used.
            > > In effect you are matching nothing with a comma before it.
            >
            > Get it. That, of course, is the reason why consecutive n's jumps to
            > every comma but the first.
            >
            > Let me rephrase, then. Why is only the second comma highlighted (I have
            > 'hlsearch' on)?

            Good question. I'll have to look at the code to find out. It's
            probably because of matching an empty string.

            --
            hundred-and-one symptoms of being an internet addict:
            64. The remote to the T.V. is missing...and you don't even care.

            /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
            /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
            \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
            \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
          Your message has been successfully submitted and would be delivered to recipients shortly.