> I don't know if it's OK to ask questions like these on this list,
It's a pretty gracious mailing list, so even non-Vim regexp
questions are tolerated. However vim-specific regexps are par
for the course and perfectly welcome.
> but could someone tell me what this line means:
> matchstr(getline('.'), '\\\(no\)\?bibliography{\zs.\{-}\ze}')
>
> I understand the matchstr and getline part but not the ('.'),
> '\\\(no\)\?bibliography{\zs.\{-}\ze}' part.
> It seems to be a regex but how is it build up?
The "getline('.')" merely gets the current line
This looks like a LaTeX match:
\\ a literal "\"
\( begin a group
no the literal "no"
\) close the group
\? 0-or-1 of that previous atom ("no")
bibliography the literal "bibliography"
{ a literal "{"
\zs reset the start of the match to begin here
.\{-} anything (non-greedy, so matches up to but
but not including the next "}")
\ze reset the end of the match to end here
} a literal "}"
So it looks in the current line (getline('.')) for either
"\nobibliography{...}" or "\bibliography{...}" and then grabs the
stuff in the {...} to be returned by matchstr().
-tim
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---