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

A trifling syntax highlight question

Expand Messages
  • Stanislav Yaglo
    Hi, there is the question: There is a string such as some text *|Text 1|* some other *|Text 2|* and so on in a text. I need to highlight only *|Text 1|* and
    Message 1 of 3 , Nov 1, 2005
    • 0 Attachment
      Hi, there is the question:
      There is a string such as "some text *|Text 1|* some other *|Text 2|*
      and so on" in a text. I need to highlight only *|Text 1|* and
      *|Text 2|*.
      I did like this:

      syntax match Comment /\*|.*|\*/

      But it highlights everything that is between *| and |*, i.e.
      *|Text 1|* some other *|Text 2|*

      How can I make it work correctly?

      With regards, Stanislav.
    • Peter Hodge
      Try having the wildcard in the centre of the pattern match as few chars as ... HTH, Peter ... ____________________________________________________ Do you
      Message 2 of 3 , Nov 1, 2005
      • 0 Attachment
        Try having the wildcard in the centre of the pattern match as few chars as
        possible:

        :syntax match Comment /\*|.\{-}|\*/

        HTH,
        Peter



        --- Stanislav Yaglo <stasvim@...> wrote:

        > Hi, there is the question:
        > There is a string such as "some text *|Text 1|* some other *|Text 2|*
        > and so on" in a text. I need to highlight only *|Text 1|* and
        > *|Text 2|*.
        > I did like this:
        >
        > syntax match Comment /\*|.*|\*/
        >
        > But it highlights everything that is between *| and |*, i.e.
        > *|Text 1|* some other *|Text 2|*
        >
        > How can I make it work correctly?
        >
        > With regards, Stanislav.
        >
        >




        ____________________________________________________
        Do you Yahoo!?
        The New Yahoo! Movies: Check out the Latest Trailers, Premiere Photos and full Actor Database.
        http://au.movies.yahoo.com
      • Stanislav Yaglo
        Thanks Peter, it does what I need.
        Message 3 of 3 , Nov 1, 2005
        • 0 Attachment
          Thanks Peter, it does what I need.

          В Срд, 02/11/2005 в 14:34 +1100, Peter Hodge пишет:
          > Try having the wildcard in the centre of the pattern match as few chars as
          > possible:
          >
          > :syntax match Comment /\*|.\{-}|\*/
          >
          > HTH,
          > Peter
        Your message has been successfully submitted and would be delivered to recipients shortly.