I know how to negate a single character match using the
[^x] - for a single character
[^a-z] - for a range of characters
I needed to be able to do a negative match (that is, match everything EXCEPT the regex pattern) for a project.
The easiest way I found that worked for my little problem was using the
:v/someregex/
command. This is similar to the :g// command except that it returns everything except the regex matches.
I think that you might also be able to use the negative lookahead regex pattern. I will save that for a future article.
Update: The negative look-ahead assertion articles is here!
Wednesday, April 15, 2009
Subscribe to:
Post Comments (Atom)
3 comments:
Ah, :v was helpful. Thanks!
You're welcome! :)
Excelent tip!!
That was really great!
thanks!
Post a Comment