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

Re: /{pattern }

Expand Messages
  • Ben Schmidt
    ... Yes. But it will highlight multiple backslashes in a row which was to be avoided. Indeed, it is nothing more than the much simpler pattern because of
    Message 1 of 15 , Apr 1, 2008
    • 0 Attachment
      Eric Roberts wrote:
      > Maybe I'm crazy here, but after a brief look over I think this is the
      > pattern you're looking for:
      > [^\\]*\zs\\\ze[^\\]*
      >
      > Basicially, 0 or more non-backslashes followed by a start and end match
      > on a backslash followed by 0 or more non backslashes. I typed this into
      > a search pattern in Vim and it seemed to correctly highlight individual
      > backslashes

      Yes. But it will highlight multiple backslashes in a row which was to be avoided.

      Indeed, it is nothing more than the much simpler pattern

      \\

      because of the possibility of having zero non-backslashes either side. :-)

      Having one or more non-backslashes in a row doesn't work with \zs and \ze because
      they get eaten up by the matching engine, so only every second backslash matches
      in text such as \a\b\c\d. This problem is avoided by using \@! and \@<! as has
      been demonstrated (IIRC).

      Ben.


      --~--~---------~--~----~------------~-------~--~----~
      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.