Vim does a lot of optimization of regular expressions, but I do not
know how it would perform in this case.  I would just try it and see.
If it does not work well, that would be a good reason to try :syn match
instead of :match .

HTH                                     --Benji Fisher

On Sun, Aug 06, 2006 at 09:59:31AM -0700, Mohsin wrote:
> I can try making a large regexp. I was under the impression that
> alternating regexps can be exponentially slow. Is %l %c %v matching
> is implemented in constant time? ie. Does vim try to match the regexp
> at every point - or it can optimize and  start matching from the given line?
> Nothing to do with implementation just the hard theoretical limit,
> I am afraid, this might not work on slower machines.
> 
> thanks
> mohsin
> 
> On 8/5/06, Benji Fisher <[EMAIL PROTECTED]> wrote:
> >
> >     I think that Tony mentioned
> >
> >:help /\|
> >
> >in a previous post, but maybe you missed it.  I just tried
> >
> >:highlight User1 term=bold,underline cterm=bold,underline 
> >gui=bold,underline
> >:match User1 /\%>3l.\%<7l\&\%>3v.\%<7v\|\%>12l.\%<18l\&\%<33v.\%>20v/
> >                                      ^^
> >
> >and it marked two rectangular regions in this e-mail.  I admit that this
> >is just a proof of concept, not very convenient to use.  It should not
> >be too hard to store a List of Lists, each inner list giving the
> >boundaries of a rectangle (four Numbers), and then to write a function
> >that processes this list to :execute the appropriate :match statement.
> >Then another function could add or remove Lists to the outer List.
> >
> >:help List      " vim 7.0 only
> >:help :for      " ditto
> >
> >     It is also possible to use ":syn match" instead of ":match".  Each
> >approach has some advantages.  Without knowing how you would want to use
> >such a feature, I do not know which would be more appropriate.
> >
> >HTH                                     --Benji Fisher
> >

Reply via email to