Somethimes I need a RegExp which uses a complex pattern multiple times. If I copy the same pattern there it works, but this is error prone as I then need to change each occurence of the pattern individualy if I want to make changes in the future.
Is there a way to either name a pattern, or even better, store it somewhere so that I can reuse it over multiple functions?
Consider the following code:
(defun complex-stuff () "" (interactive) (beginning-of-buffer) (save-excursion (query-replace-regexp "a \\(<complex-patten>\\) b \\(<complex-pattern>\\)" "x \\1 y \\2")))
<complex-pattern> is some valid expression that I wish to reuse.