I've tried to debug an indent function i've written, and came over this strange behaviour. Here I try to detect some LateX tags (debug output):
>echo previous
\label{ch10.1}
>echo previous =~ "\\label"
1
This looks fine. Now i try to do the same thing with the \begin
tag:
>echo previous
\begin{uxlist}
>echo previous =~ "\\begin"
0
It somehow works with \\\\
:
>echo previous
\begin{uxlist}
>echo previous =~ "\\\\begin"
1
Which makes no sense at all for me. Is this expected behaviour? If yes I would be rather glad for an explanation.
Thanks in advance
Update
I solved it by replacing doublequotes with singlequotes. But it is still strange for example this:
>echo previous
\end{itemize}
>previous =~ "\\item"
1
>previous =~ "\\end"
0
it looks like \\end
is somehow interpreted as \e
(Escape) which can not be found. That would mean I had to esacpe each backslash 2 times, which is why it works with 4 backslashes.
But as far as I know, that shouldn't be needed?