I've the following content:
a1a foo bar buzz
foo b2b bar buzz
foo bar c3c buzz
foo bar buzz d4d
where I can match all words consisting only alpha characters by the following pattern:
/\<[a-zA-Z]*\>
Now, how can I remove all words which doesn't match the pattern?
So the final content is:
foo bar buzz
foo bar buzz
foo bar buzz
foo bar buzz
I've checked Search for lines not containing pattern page, but without luck.
To remove some words patching the pattern, global command can be used:
:g/\<[a-zA-Z]*\>/;&
as per this post.
However when doing opposite:
:v/\<[a-zA-Z]*\>/;&
there is this message:
Pattern found in every line
\a\d\a
and remove that. But that doesn't answer the general question of How to remove something that doesn't match a search