Add one to a number using Emacs’ regexp

I recently had to add one to all numbers of the form =”n”= where n is a number in a text file. Thanks to jlf on #emacs, I could do so with the the command replace-regexp to change =\”\([0-9]+\)\”= to =”\,(1+ \#1)”=. I’m never going to remember this so I’m writing it down now.

About Vinh Nguyen

Statistician

2 comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>