I have a text file and I would like to compose a regular expression
that matches lines containing stringB but not preceded by a line
containing string A.  I thought one of these might do it:

   \(stringA.*\n\)\@<!.*stringB
   \(stringA.*\n\)\@<!\(.*stringB\)

The \@<! was *intended* to ensure a non-match with stringA in the
preceding line.  However, they highlight the same lines that are
highlighted by the opposite regular expressions:

   \(stringA.*\n\)\@<=.*stringB
   \(stringA.*\n\)\@<=\(.*stringB\)

With a little pondering, it is obvious why. The first .* matches any
set of characters, so even if stringA exists in the preceding line,
you can always find some portion of the line that doesn't match
\(stringA.*\n\).

Is there a way to achieve the search described in above?

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to