Vim regex examples

A list of Vim regex examples which might be useful for code/text refactoring.

Not something (excluding some character)

The regex below will match every non-space character and replace it with nothing (so it will be removed).

s/[^ ]*//c

Example line: 2017-0-05 13:05:15 will become 13:05:15

Explanation: From the beginning of the line all non-space characters will be removed. Because there is no g (global) modifier the replacement process will stop after first encountered space.