>>>>> "tim" == Tim Morley \(remove vegetable for email address\) writes: tim> Does anybody know of a way to include an incrementing number in a tim> regexp search-and-replace in Emacs? What I want to do is search tim> for a regexp, and the first time I find it, replace it with "case tim> 1", the second time replace it with "case 2", etc. Here's a function that I wrote a while ago...almost what you want. When run interactively, gives something like: Replace [n] skip [1] case1 [2] case2 [3] case3? Press [n] to skip to next match, [1-3] to replace with the case1-3, [return] to quit. Could be modified pretty easily to autoincrement a value in the replace string. ...cj