Sunday, July 6, 2014

Re: syntax highlighting with regular expressions


Den 6 jul 2014 01:03 skrev "Ben Fritz" <fritzophrenic@gmail.com>:
>
> On Saturday, July 5, 2014 5:26:15 PM UTC-5, Mark Volkmann wrote:
> > I'm trying to use "syntax region" with start=regex and end=regex, but having difficulty.
> > I want the region to match what follows the start regex and precedes the end regex.
> > For example, say I want to match whatever follows "foo" or "bar" and precedes "baz" or "qux".
> >
> > So in these two examples, the word "test" should be highlighted:
> >
> >
> >   footestbaz
> >   bartestqux
> >
> >
> > Can someone show me an example that is similar to this?
>
> Why is it important that foo and baz don't get matched? Do you really need them not part of the match, or is it sufficient if they are matched but not highlighted? Or, highlighted differently from "test"?

Just out of curiosity (I'm in a vim-less environment ATM) would start='\%(foo\)\@<=' end='\%(bar\)\@=' work? Would it be undesirable even if it does work?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: