6

Is it possible to replace regex like query-replace-regex without asking for each matching ?

Drew
  • 75,699
  • 9
  • 109
  • 225
user3593232
  • 383
  • 1
  • 8
  • 4
    There is always `replace-regexp` (note the lack of the `query-` prefix). Not posting this as an answer since I am not quite sure where you want to go with the second question. Also, note that even with `query-replace-regexp`, you can try it out on a match or two, just to see you got it right, then hit `!` and it will do the rest without asking. The keypress `,` is very useful in this mode: It replaces, but does not move on, so you can see what happened. – Harald Hanche-Olsen Nov 28 '15 at 08:30
  • Thanks, replace-regexp is the answer to the first, I understand why it's called query now. For the second quetsion I would like to type something like `s/regexp/replace/options`, using sed would be a solution. – user3593232 Nov 28 '15 at 08:41
  • 1
    Please don't ask multiple unrelated questions in the same post. Edit the sed/vim bit out of this, and ask it in a separate question. Harald Hanche-Olsen can then convert that comment to a proper answer. – phils Nov 28 '15 at 09:40

1 Answers1

7

Use replace-regexp (note the absence of the query- prefix).

But also, note the ! keybinding when running query-replace-regexp. It will replace all occurences beyond point without further questions.

Harald Hanche-Olsen
  • 2,401
  • 12
  • 15