In a new buffer, make 10 empty lines. (NOTE: they don't have to be empty) Select any five lines (i.e. a text selection) Search for $ (with hypersearch, selection, and regular expressions turned on) This only matches the first 4 lines. The fifth is not matched Now search for $ and replace with z Since the fifth line was not matched, z is placed on only the first 4 lines. Please note: -- ^ works fine. Just $ demonstrates this behaviour -- the lines do not have to be empty. This is reproducable for non-empty lines as well, and any mixture of empty non-empty lines