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

/{pattern }

Expand Messages
  • axel-woehrle@t-online.de
    Hello, /[^ ] [^ ]/e-1 is my searchpattern (searching for a backslash, but not for some backslashes followed ... norm v./ [ d {1,2} ].* [ d {1,2} ]/ey ...
    Message 1 of 15 , Mar 25, 2008
      Hello,
      /[^\\]\\[^\\]/e-1

      "is my searchpattern (searching for a backslash, but not for some
      backslashes followed"

      :/\[\d\{1,2}\].*\[\d\{1,2}\]/
      "norm v./\[\d\{1,2}\].*\[\d\{1,2}\]/ey
      :let match = matchstr(getline("\[\d\{1,2}\].*\[\d\{1,2}\]/"), ("\\[\\d\
      \{1,2}\\].*\\[\\d\\{1,2}\\]/")

      "are 3 textlines in buffer"

      What to do, that it matches also the string "[\d" ??!! The
      "[" (literally) seems to be the problem, but I found no possibility.
      Who knows?


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Ben Schmidt
      ... I am finding it difficult to understand your language. Perhaps you could explain what you are trying to do and provide an example? There seem to be a
      Message 2 of 15 , Mar 26, 2008
        axel-woehrle@... wrote:
        > Hello,
        > /[^\\]\\[^\\]/e-1
        >
        > "is my searchpattern (searching for a backslash, but not for some
        > backslashes followed"
        >
        > :/\[\d\{1,2}\].*\[\d\{1,2}\]/
        > "norm v./\[\d\{1,2}\].*\[\d\{1,2}\]/ey
        > :let match = matchstr(getline("\[\d\{1,2}\].*\[\d\{1,2}\]/"), ("\\[\\d\
        > \{1,2}\\].*\\[\\d\\{1,2}\\]/")
        >
        > "are 3 textlines in buffer"
        >
        > What to do, that it matches also the string "[\d" ??!! The
        > "[" (literally) seems to be the problem, but I found no possibility.
        > Who knows?

        I am finding it difficult to understand your language. Perhaps you could explain
        what you are trying to do and provide an example?

        There seem to be a number of things wrong with your patterns, etc., but perhaps
        some are caused by lines being wrapped in email or other errors when copying into
        the email. Two starting points that will be giving you trouble though are:

        - The argument to 'getline' is invalid: it needs to be '.' or '$' or something
        like that (as documented at :help line()) You probably want '.' since you moved
        the cursor to the line you wanted with an earlier command.
        - You will be having problems because your patterns are in double quotes (") so
        Vim will be interpreting the backslashes as string escapes not as part of the
        pattern. You should use single quotes ('). (You have, it seems, compensated for
        this in one place by doubling backslashes, but not everywhere. Using single quotes
        avoids the need for this extra doubling of backslashes.)
        - Your parentheses are unbalanced.

        Ben.





        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Balsam Digital Media
        Sure, there is a bit confusion- let me try to explain exactly: this is my searchpattern: /[^ ] [^ ] I want to find all single backslashes, NOT SURROUNDED OR
        Message 3 of 15 , Mar 26, 2008
          Sure, there is a bit confusion- let me try to explain exactly:
          this is my searchpattern:       
          /[^\\]\\[^\\]
          
          I want to find all single backslashes, NOT SURROUNDED OR FOLLOWED BY ONE OR MORE OTHER backslashes.
          This pattern works fine, but not, when there is a lettersequence like ".\.\." (dots is meaning all letters excluding backslashes)in the current buffer; exactly:
          in this example only the FIRST backslash is matched by the searchpattern, but NOT the SECOND.
          How must be changed the searchpattern?
          I was trying hours and got really crazy with it!
          

          Ben Schmidt schrieb:
          axel-woehrle@... wrote:
            
          Hello,
          /[^\\]\\[^\\]/e-1
          
          "is my searchpattern (searching for a backslash, but not for some
          backslashes followed"
          
          :/\[\d\{1,2}\].*\[\d\{1,2}\]/
          "norm v./\[\d\{1,2}\].*\[\d\{1,2}\]/ey
          :let match = matchstr(getline("\[\d\{1,2}\].*\[\d\{1,2}\]/"), ("\\[\\d\
          \{1,2}\\].*\\[\\d\\{1,2}\\]/")
          
          "are 3 textlines in buffer"
          
          What to do, that it matches also the string "[\d" ??!! The
          "[" (literally) seems to be the problem, but I found no possibility.
          Who knows?
              
          I am finding it difficult to understand your language. Perhaps you could explain 
          what you are trying to do and provide an example?
          
          There seem to be a number of things wrong with your patterns, etc., but perhaps 
          some are caused by lines being wrapped in email or other errors when copying into 
          the email. Two starting points that will be giving you trouble though are:
          
          - The argument to 'getline' is invalid: it needs to be '.' or '$' or something 
          like that (as documented at :help line()) You probably want '.' since you moved 
          the cursor to the line you wanted with an earlier command.
          - You will be having problems because your patterns are in double quotes (") so 
          Vim will be interpreting the backslashes as string escapes not as part of the 
          pattern. You should use single quotes ('). (You have, it seems, compensated for 
          this in one place by doubling backslashes, but not everywhere. Using single quotes 
          avoids the need for this extra doubling of backslashes.)
          - Your parentheses are unbalanced.
          
          Ben.
          
          
          
          
          
          
          
            

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

        • Tony Mechelynck
          ... Your pattern doesn t match it matches . . so, when scanning . . . the second scan starts at the second which is not a non-backslash: no match there.
          Message 4 of 15 , Mar 26, 2008
            Balsam Digital Media wrote:
            > Sure, there is a bit confusion- let me try to explain exactly:
            > this is my searchpattern:
            >
            > /[^\\]\\[^\\]
            >
            > I want to find all single backslashes, NOT SURROUNDED OR FOLLOWED BY ONE OR MORE OTHER backslashes.
            > This pattern works fine, but not, when there is a lettersequence like ".\.\." (dots is meaning all letters excluding backslashes)in the current buffer; exactly:
            > in this example only the FIRST backslash is matched by the searchpattern, but NOT the SECOND.
            > How must be changed the searchpattern?
            > I was trying hours and got really crazy with it!
            >
            >
            > Ben Schmidt schrieb:
            >> axel-woehrle@... wrote:
            >>
            >>> Hello,
            >>> /[^\\]\\[^\\]/e-1
            >>>
            >>> "is my searchpattern (searching for a backslash, but not for some
            >>> backslashes followed"
            >>>
            >>> :/\[\d\{1,2}\].*\[\d\{1,2}\]/
            >>> "norm v./\[\d\{1,2}\].*\[\d\{1,2}\]/ey
            >>> :let match = matchstr(getline("\[\d\{1,2}\].*\[\d\{1,2}\]/"), ("\\[\\d\
            >>> \{1,2}\\].*\\[\\d\\{1,2}\\]/")
            >>>
            >>> "are 3 textlines in buffer"
            >>>
            >>> What to do, that it matches also the string "[\d" ??!! The
            >>> "[" (literally) seems to be the problem, but I found no possibility.
            >>> Who knows?
            >>>
            >>
            >> I am finding it difficult to understand your language. Perhaps you could explain
            >> what you are trying to do and provide an example?
            >>
            >> There seem to be a number of things wrong with your patterns, etc., but perhaps
            >> some are caused by lines being wrapped in email or other errors when copying into
            >> the email. Two starting points that will be giving you trouble though are:
            >>
            >> - The argument to 'getline' is invalid: it needs to be '.' or '$' or something
            >> like that (as documented at :help line()) You probably want '.' since you moved
            >> the cursor to the line you wanted with an earlier command.
            >> - You will be having problems because your patterns are in double quotes (") so
            >> Vim will be interpreting the backslashes as string escapes not as part of the
            >> pattern. You should use single quotes ('). (You have, it seems, compensated for
            >> this in one place by doubling backslashes, but not everywhere. Using single quotes
            >> avoids the need for this extra doubling of backslashes.)
            >> - Your parentheses are unbalanced.
            >>
            >> Ben.

            Your pattern doesn't match \ it matches .\. so, when scanning .\.\. the
            second scan starts at the second \ which is not a non-backslash: no
            match there.

            Trying your pattern on .\.\.\.\.\.\.\. would match only odd (not even)
            backslashes).

            /[^\\]\zs\\\ze[^\\]

            would, I think, match all backslashes not preceded or followed by a
            backslash, but it wouldn't match a backslash at the start or end of a line.

            /\_[^\\]\zs\\\ze\_[^\\]

            would, I think, match every unpaired backslash except at the start and
            end of the file.

            /\\\@<!\\\@!\\

            would, I think, match every unpaired backslash anywhere.

            Please test them (I didn't).


            Best regards,
            Tony.
            --
            Stay away from flying saucers today.

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Balsam Digital Media
            First thank you for your great help- /[^ ] zs ze[^ ] does exactly what you thought of ... / _[^ ] zs ze _[^ ] doesn t match at start of file, but
            Message 5 of 15 , Mar 26, 2008
              First thank you for your great help-

              /[^\\]\zs\\\ze[^\\]
              does exactly what you thought of
              ---------------------------------
              /\_[^\\]\zs\\\ze\_[^\\]
              doesn't match at start of file, but matches at the end
              ----------------------------------------------------
              /\\\@<!\\\@!\\
              doesn't match anything!
              -----------------------
              How to get it working?

              Tony Mechelynck schrieb:
              Balsam Digital Media wrote:
                
              Sure, there is a bit confusion- let me try to explain exactly:
              this is my searchpattern:
              
              /[^\\]\\[^\\]
              
              I want to find all single backslashes, NOT SURROUNDED OR FOLLOWED BY ONE OR MORE OTHER backslashes.
              This pattern works fine, but not, when there is a lettersequence like ".\.\." (dots is meaning all letters excluding backslashes)in the current buffer; exactly:
              in this example only the FIRST backslash is matched by the searchpattern, but NOT the SECOND.
              How must be changed the searchpattern?
              I was trying hours and got really crazy with it!
              
              
              Ben Schmidt schrieb:
                  
              axel-woehrle@...  wrote:
              
                    
              Hello,
              /[^\\]\\[^\\]/e-1
              
              "is my searchpattern (searching for a backslash, but not for some
              backslashes followed"
              
              :/\[\d\{1,2}\].*\[\d\{1,2}\]/
              "norm v./\[\d\{1,2}\].*\[\d\{1,2}\]/ey
              :let match = matchstr(getline("\[\d\{1,2}\].*\[\d\{1,2}\]/"), ("\\[\\d\
              \{1,2}\\].*\\[\\d\\{1,2}\\]/")
              
              "are 3 textlines in buffer"
              
              What to do, that it matches also the string "[\d" ??!! The
              "[" (literally) seems to be the problem, but I found no possibility.
              Who knows?
              
                      
              I am finding it difficult to understand your language. Perhaps you could explain
              what you are trying to do and provide an example?
              
              There seem to be a number of things wrong with your patterns, etc., but perhaps
              some are caused by lines being wrapped in email or other errors when copying into
              the email. Two starting points that will be giving you trouble though are:
              
              - The argument to 'getline' is invalid: it needs to be '.' or '$' or something
              like that (as documented at :help line()) You probably want '.' since you moved
              the cursor to the line you wanted with an earlier command.
              - You will be having problems because your patterns are in double quotes (") so
              Vim will be interpreting the backslashes as string escapes not as part of the
              pattern. You should use single quotes ('). (You have, it seems, compensated for
              this in one place by doubling backslashes, but not everywhere. Using single quotes
              avoids the need for this extra doubling of backslashes.)
              - Your parentheses are unbalanced.
              
              Ben.
                    
              Your pattern doesn't match \ it matches .\. so, when scanning .\.\. the 
              second scan starts at the second \ which is not a non-backslash: no 
              match there.
              
              Trying your pattern on .\.\.\.\.\.\.\. would match only odd (not even) 
              backslashes).
              
              	/[^\\]\zs\\\ze[^\\]
              
              would, I think, match all backslashes not preceded or followed by a 
              backslash, but it wouldn't match a backslash at the start or end of a line.
              
              	/\_[^\\]\zs\\\ze\_[^\\]
              
              would, I think, match every unpaired backslash except at the start and 
              end of the file.
              
              	/\\\@<!\\\@!\\
              
              would, I think, match every unpaired backslash anywhere.
              
              Please test them (I didn't).
              
              
              Best regards,
              Tony.
                

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

            • A.Politz
              ... You need zero-width pattern, which don t consume characters (That s why your pattern isn t working.). v( )@
              Message 6 of 15 , Mar 26, 2008
                Balsam Digital Media wrote:

                >Sure, there is a bit confusion- let me try to explain exactly:
                >this is my searchpattern:
                >
                >/[^\\]\\[^\\]
                >
                >I want to find all single backslashes, NOT SURROUNDED OR FOLLOWED BY ONE OR MORE OTHER backslashes.
                >This pattern works fine, but not, when there is a lettersequence like ".\.\." (dots is meaning all letters excluding backslashes)in the current buffer; exactly:
                >in this example only the FIRST backslash is matched by the searchpattern, but NOT the SECOND.
                >How must be changed the searchpattern?
                >I was trying hours and got really crazy with it!
                >
                >
                >
                You need zero-width pattern, which don't consume characters
                (That's why your pattern isn't working.).

                \v(\\)@<!\\(\\)@!

                :h \v
                :h pattern


                -ap

                --
                :wq


                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • axel-woehrle@t-online.de
                that works, great! thank you! AW ... --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more
                Message 7 of 15 , Mar 26, 2008
                  that works, great!
                  thank you!
                  AW

                  On Mar 26, 9:02 pm, "A.Politz" <poli...@...> wrote:
                  > Balsam Digital Media wrote:
                  > >Sure, there is a bit confusion- let me try to explain exactly:
                  > >this is my searchpattern:      
                  >
                  > >/[^\\]\\[^\\]
                  >
                  > >I want to find all single backslashes, NOT SURROUNDED OR FOLLOWED BY ONE OR MORE OTHER backslashes.
                  > >This pattern works fine, but not, when there is a lettersequence like ".\.\." (dots is meaning all letters excluding backslashes)in the current buffer; exactly:
                  > >in this example only the FIRST backslash is matched by the searchpattern, but NOT the SECOND.
                  > >How must be changed the searchpattern?
                  > >I was trying hours and got really crazy with it!
                  >
                  > You need zero-width pattern, which don't consume characters
                  > (That's why your pattern isn't working.).
                  >
                  > \v(\\)@<!\\(\\)@!
                  >
                  > :h \v
                  > :h pattern
                  >
                  > -ap
                  >
                  > --
                  > :wq
                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • Tony Mechelynck
                  ... It matches at end because your file probably has an end-of-line character after the backslash. I guess it wouldn t match in the same file, after ... OK,
                  Message 8 of 15 , Mar 26, 2008
                    Balsam Digital Media wrote:
                    > First thank you for your great help-
                    >
                    > /[^\\]\zs\\\ze[^\\]
                    >
                    > does exactly what you thought of
                    > ---------------------------------
                    >
                    > /\_[^\\]\zs\\\ze\_[^\\]
                    >
                    > doesn't match at start of file, but matches at the end
                    > ----------------------------------------------------

                    It matches at end because your file probably has an end-of-line
                    character after the backslash. I guess it wouldn't match in the same
                    file, after

                    :setlocal bin noeol

                    >
                    > /\\\@<!\\\@!\\
                    >
                    > doesn't match anything!
                    > -----------------------
                    > How to get it working?

                    OK, let's try a different approach (correcting the previous pattern
                    instead of introducing zero-length conditional matches):

                    /\%(^\|[^\\]\)\zs\\\ze\%([^\\]\|$\)

                    i.e.
                    \%(^\|[^\\]\) (start-of-line or non-backslash)
                    \zs (match starts here)
                    \\ backslash
                    \ze (match ends here)
                    \%([^\\]\|$\) (non-backslash or end-of-line)


                    Best regards,
                    Tony.
                    --
                    "I drink to make other people interesting."
                    -- George Jean Nathan

                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_use" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Ben Schmidt
                    ... Remove the two backslashes from the end and put them in the middle! Tony accidentally asked it to check it was at a position where a backslash didn t match
                    Message 9 of 15 , Mar 26, 2008
                      > /\\\@<!\\\@!\\
                      >
                      > doesn't match anything!
                      > -----------------------
                      > How to get it working?

                      Remove the two backslashes from the end and put them in the middle!

                      Tony accidentally asked it to check it was at a position where a backslash didn't
                      match and then to match a backslash at that position. He wanted the opposite order.

                      /\\\@<!\\\\\@!

                      (Untested.)

                      Ben.





                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_use" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    • Balsam Digital Media
                      ... No difference, when I set this option, pattern matches at the end ... This pattern works perfect, thank you very much, now regex-patterns aren t so strange
                      Message 10 of 15 , Mar 27, 2008
                        >/\_[^\\]\zs\\\ze\_[^\\]
                        
                        > >doesn't match at start of file, but matches at the end >----------------------------------------------------
                        >
                        
                        >It matches at end because your file probably has an end-of-line >character after the backslash. I guess it wouldn't match in the same >file, after > > :setlocal bin noeol
                        No difference, when I set this option, pattern matches at the end

                        >/\%(^\|[^\\]\)\zs\\\ze\%([^\\]\|$\)
                        This pattern works perfect, thank you very much, now regex-patterns aren't so strange for me anymore, not like before.
                        AW

                        Tony Mechelynck schrieb:
                        Balsam Digital Media wrote:
                          
                        First thank you for your great help-
                        
                        /[^\\]\zs\\\ze[^\\]
                        
                        does exactly what you thought of
                        ---------------------------------
                        
                        /\_[^\\]\zs\\\ze\_[^\\]
                        
                        doesn't match at start of file, but matches at the end
                        ----------------------------------------------------
                            
                        It matches at end because your file probably has an end-of-line 
                        character after the backslash. I guess it wouldn't match in the same 
                        file, after
                        
                        	:setlocal bin noeol
                        
                          
                        /\\\@<!\\\@!\\
                        
                        doesn't match anything!
                        -----------------------
                        How to get it working?
                            
                        OK, let's try a different approach (correcting the previous pattern 
                        instead of introducing zero-length conditional matches):
                        
                        	/\%(^\|[^\\]\)\zs\\\ze\%([^\\]\|$\)
                        
                        i.e.
                        	\%(^\|[^\\]\)          (start-of-line or non-backslash)
                        	\zs                    (match starts here)
                        	\\                     backslash
                        	\ze                    (match ends here)
                        	\%([^\\]\|$\)          (non-backslash or end-of-line)
                        
                        
                        Best regards,
                        Tony.
                          

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

                      • Balsam Digital Media
                        Your corrected pattern works fine, so I learned something about zero width; although, the very magic version is much more easier to read for me:
                        Message 11 of 15 , Mar 27, 2008
                          Your corrected pattern works fine, so I learned something about zero width;
                          although, the "very magic" version is much more easier to read for me: /\v(\\)@<!\\(\\)@!



                          Ben Schmidt schrieb:
                          /\\\@<!\\\@!\\
                          
                          doesn't match anything!
                          -----------------------
                          How to get it working?
                              
                          Remove the two backslashes from the end and put them in the middle!
                          
                          Tony accidentally asked it to check it was at a position where a backslash didn't 
                          match and then to match a backslash at that position. He wanted the opposite order.
                          
                          /\\\@<!\\\\\@!
                          
                          (Untested.)
                          
                          Ben.
                          
                          
                          
                          
                          
                          
                          
                            

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

                        • Ben Schmidt
                          ... Correct. Vim only honours the bin and noeol options by omitting an EOL when it writes the file. While editing the file it still has the EOL on the last
                          Message 12 of 15 , Mar 27, 2008
                            >>It matches at end because your file probably has an end-of-line
                            >>character after the backslash. I guess it wouldn't match in the same
                            >>file, after
                            >>
                            >> :setlocal bin noeol
                            >
                            > No difference, when I set this option, pattern matches at the end

                            Correct. Vim only honours the bin and noeol options by omitting an EOL when it
                            writes the file. While editing the file it still has the EOL on the last line.

                            Ben.





                            --~--~---------~--~----~------------~-------~--~----~
                            You received this message from the "vim_use" maillist.
                            For more information, visit http://www.vim.org/maillist.php
                            -~----------~----~----~----~------~----~------~--~---
                          • Ben Schmidt
                            ... Yes. It is much easier to read, particularly as it contains brackets which aren t necessary but make it more readable. It could just be / v @
                            Message 13 of 15 , Mar 27, 2008
                              Balsam Digital Media wrote:
                              > Your corrected pattern works fine, so I learned something about zero width;
                              > although, the "very magic" version is much more easier to read for me: /\v(\\)@<!\\(\\)@!

                              Yes. It is much easier to read, particularly as it contains brackets which aren't
                              necessary but make it more readable. It could just be

                              /\v\\@<!\\\\@!

                              Which isn't so nice. If you're running out of subpatterns (you can only have nine)
                              you may want to use groups that aren't subpatterns by using %:

                              /\v%(\\)@<!\\%(\\)@!

                              Or without verymagic:

                              /\%(\\\)\@<!\\\%(\\\)\@!

                              Yuck!

                              Smiles,

                              Ben.




                              --~--~---------~--~----~------------~-------~--~----~
                              You received this message from the "vim_use" maillist.
                              For more information, visit http://www.vim.org/maillist.php
                              -~----------~----~----~----~------~----~------~--~---
                            • Eric Roberts
                              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
                              Message 14 of 15 , Apr 1, 2008
                                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

                                Cheers,

                                - Eric


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

                              • 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 15 of 15 , Apr 1, 2008
                                  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.