2

I want to replace some digits by letters such that

1 ---> a
2 ---> b
...

In emacs I have tried the following replacement:

M-x query-replace-regexp RET \([0-9]+\) RET \,(string (+ ?a \#1)) RET

It works, but in replacement I obtain 1 --> b, 2 --> c, and so on. Please, how can I fix it?

PS: I know that with my code 26 --> {, but it is not a problem because my digits are generally less than 26.

Onner Irotsab
  • 431
  • 2
  • 9

1 Answers1

2

The following should work:

M-x query-replace-regexp RET \([0-9]+\) RET \,(string (+ (1- ?a) \#1)) RET
InHarmsWay
  • 1,309
  • 7
  • 8