title: Emacs lisp escaping regexp
body: <p>As a first experience in defining a function for emacs, I would like to make write a function that take all occurences of argv[some number] and renumber them in order.</p>
  
  <p>This is done inside emacs with replace-regexp, entering as search/replace strings</p>
  
  <pre><code>argv\[\([0-9]+\)\]
  argv[\,(+ 1 \#)]
  </code></pre>
  
  <p>Now, I want to write this in my .emacs so I understand I need to escape also for Lisp special characters. So in my opinion it should write</p>
  
  <pre><code>(defun argv-order () 
    (interactive)
    (goto-char 1)
    (replace-regexp "argv\\[[0-9]+\\]" "argv[\\,\(+ 1 \\#\)]")
  )
  </code></pre>
  
  <p>The search string works fine but the replacement string gives me the error "invalid use of \ in replacement text. I've been trying around adding or removing some \ but with no success.</p>
  
  <p>Any idea ?</p>