This is like Global Replace, but instead of replacing every occurrence, it stops at each one and asks whether you want to replace it or move to the next occurrence.
1. Type M-^R
You are first prompted for the text you want to replace. The prompt will look like this:
Query replace []<META>:
2. Type in the text you want to replace and press the META key.
You will then be prompted for the text you want to insert. The prompt will look like this:
with []<META>:
3. Type in the text you want to insert and press the META key.
The cursor will move to each occurrence of the text you want to replace. Each time you will be given a prompt like this:
Replace 'junk' with 'test'?
4. Type in one of the options:
y (yes, do this replace) n (no, don't do this replace) ! (Do replaces without asking) ^G (stop now)