On Tue, 2 May 2006, o1792 wrote:

[snip]
if you want to find anything that is not any word
ending in "ion",
well the regex group you're looking at is
\(\<.\+ion\>\), but how do you
negate that? Put it all in square brackets and provide
a caret ^ at the
beginning? Nope. in fact group within square brackets
doesn't work as
might be expected. Th enegation pretty much seems to
be built for single
character negation only, not sequences.

I'm only referrign to searching here, when it comes to
substituting or
deleting, :v/etc/d seems tailor nmade to help with
negations of tricky
regex.

The regex format for a negative search is

  /\%(<search>\zs\)*

where the $ anchor, if needed, is placed after "\zs".

For example, if your search is

  /^start.*foo.*bar.*end$

to negate that, do

  /\%(^start.*foo.*bar.*end\zs$\)*

In your case of anything that is not a word ending with "ion", you'd want

  /\%(\<\w\+ion\>\zs\)*

Can't use "."; use "\w" instead. See ":help /\w" and also ":help /\zs".

HTH :)
--
Gerald

Reply via email to