+(defun riece-url-replace-match (string)
+ (let ((match-data (match-data))
+ (index 0)
+ number
+ replacement)
+ (while (string-match "\\\\[&1-9\\\\]" string index)
+ (if (eq (aref string (1+ (match-beginning 0))) ?&)
+ (setq number 0)
+ (unless (eq (aref string (1+ (match-beginning 0))) ?\\)
+ (setq number (string-to-number (substring (match-string 0 string)
+ 1)))))
+ (if number
+ (setq replacement
+ (buffer-substring (nth (* number 2) match-data)
+ (nth (1+ (* number 2)) match-data)))
+ (setq replacement "\\"))
+ (setq string (concat (substring string 0 (match-beginning 0))
+ replacement
+ (substring string (match-end 0)))
+ index (+ index (length replacement))))
+ string))
+