4

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

  • 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 8: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 8: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 9:40
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.