replace last occurrence in line

Viewed 16626

:%s/one/two/ will replace the first occurrence of one with two. Is there an easy way to replace the last occurrence, instead?

I can't assume it's next to the end-of-line, and there's nothing unique around the last occurrence to 'grab' to use, similar to this:

one two three one two three one two one two one two ...
3 Answers
Related