I want to comment out all environments say myenv
in a tex-file. I can find them with the regexp:
\\begin{myenv}\(.\|\n\).*?\\end{myenv}
(instead of \n
I had do type C-q C-j
).
But what would be the correct regexp for replacing? How to reverse it, i.e. uncomment all environments myenv
?
\excludecomment{myenv}
in the document preamble. Your regexp is interesting in the aspect that you only allow one newline behind\\begin{myenv}
and the backslash for the or-operator is missing. I would expect\\begin{myenv}\(.\|n\)*\\end{myenv}
as regexp. – Tobias Mar 22 '16 at 11:59C-q C-j
for the newline charactern
in my last comment. You have already mentioned that in your question. – Tobias Mar 22 '16 at 12:09myenv
environments and applyingcomment-region
to each match. Or applyuncomment-region
to undo it. You should be able to use the same regexp for both cases. (Sorry, don't have the time to flesh this out to a proper answer.) – Harald Hanche-Olsen Mar 22 '16 at 12:23