Super Nerdy Cool

My (technical) adventures through the professional world…
January 4, 2011

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.

2 Comments to “Add one to a number using Emacs’ regexp”

Leave a Comment