A trifling syntax highlight question

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

A trifling syntax highlight question

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


Reply | Threaded
Open this post in threaded view
|

Re: A trifling syntax highlight question

Peter Hodge-2
Try having the wildcard in the centre of the pattern match as few chars as
possible:
 
  :syntax match Comment /\*|.\{-}|\*/

HTH,
Peter



--- Stanislav Yaglo <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: A trifling syntax highlight question

Stanislav Yaglo
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