On 03/11/12 12:47, Martin Krischik wrote:
I mastered most of regular expressions. Only with the “non
matching stuff” I still have my problems. Say want to find all
lines containing Level.FINE — but not those who have been
commented out. First idea would be:

/\C\v(\/\/)@!.{-}<Level\.FINE.{0,2}>/

The @! is supposed to not match - but it still does. And I
don't even know why.

You don't give the text you're trying to match against, but sometimes turning on 'hls' can help you see why it's not matching what you think. In your case, I _suspect_ that it doesn't match starting at the "//", but that the match actually begins before or after the "//" depending on the line because the @! merely asserts that the "//" can't match at the starting point of the match (it could match before/after). To get the expression you want, I'd use

  /^\%(\%(\/\/\)\@!.\)*Level\.FINE.\{0,2}>/

which asserts that you're looking for "Level.FINE" only where "//" doesn't match at every position preceding it.

-tim


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

Reply via email to