Reputation: 2163
What is the quickest way to replace multiple characters at once in emacs? For instance I would like to act on the region and replace 1 with a, 2 with b, ..., 9 with i.
Upvotes: 3
Views: 989
Reputation: 14065
You can stitch elisp into regex replacements (not sure if you can do the same with replace-string
). For instance,
M-x query-replace-regexp \([1-9]\) \,(char-to-string (+ 96 \#1))
should replace single digits 1-9
with the letters a-i
as appropriate.
Upvotes: 5