I was asked by someone for a regular expression that could combine
several search patterns, so that a file only needs to be scanned ones
and not several times. I was partly successful, but I still need two
passes.
I now have the following code:
(defun dcbl-search-heading ()
(interactive)
(re-search-forward "\\(.
\\)\\(
\\)\\(.+
\\)\\(
?.+
\\)" nil t)
(replace-match "\\1
#heading#
\\4"))
(defun dcbl-search-heading2 ()
(interactive)
(re-search-forward "\\(.
\\)\\(
\\)\\(.+
\\)\\(\\\(.+
\\\)+\\)" nil t)
(replace-match "\\1
#heading#
\\4"))
Is there a way to combine those regular expressions to one?
By the way, if the used expressions could be optimised, let me know. I
do not make them often, thus maybe I do things sub-optimal here.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn:
http://www.linkedin.com/in/cecilwesterhof