Today I needed to replace the leading line number from a source file that was forwarded to me probably gotten from an html representation of a source repository of some sort. I know, definitely not the best way to acquire a source file this way but a good exercise nonetheless.
In Vim the following would do the trick:
:%s/^\s*\d\+//g % --> for each line ^ --> beginning of the current line \s* --> match any leading space characters \d\+ --> match any number of digits (one or more) --> replace with nothing