Recursive mappings are fun to learn and really handy when you want to do repetitive tasks. One way to do this is by recording a macro, which can be done recursively. This is another way when you find that you are using the same editing pattern again and again. Recursion may seem a bit complicated at first but it is very intuitive once you get the hang of it. Here are two examples.

The terminating condition for such a recursive mapping is that the search should not find anything. If the wrapscan is on, the search starts from the top of the document again. So setting wrapscan to off makes sure that the search has a terminating condition.