1

I want to add 400 in every line where has text "finished".

Here text and regexp:

enter image description here

as you can see the regexp is correct

"finished":\s-*[0-9]+

Nice.

Now I use this regexp in query-replace-regexp

replace by

\1\,(+ 400 (string-to-number \2))

enter image description here

But the result is error:

replace-eval-replacement: Error evaluating replacement expression: (wrong-type-argument stringp nil)
  • 3
    In order to use '\1` and '\2' you need to define 2 capture groups in your regexp. – Juancho Nov 17 '19 at 15:19
  • @Juancho Thanks. This work: M-C-% ("finished":[\s-]*)([0-9]+) RET replace by -> \1\,(1+ (string-to-number \2))RET – a_subscriber Nov 17 '19 at 15:29

Your Answer

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

Browse other questions tagged or ask your own question.