Reputation: 4210
I have the following multi-line string:
asd \cite[1][2]{foo, bar} asdf \cite{baz, bar}
foo \citet{lorem} % \cite{asd}
foo \citep{ipsum}
\citep{dolor, sit,
amet}
I want to match everything inside the curly braces (including dolor, sit, amet
), but not if it's commented out (after %
). I don't know what comes after the comment - it may be any number of spaces or characters. I currently use the following regex:
\\cite[tp]?\s*\[?.*?\]?\s*\{(.*?)\}.*?
This also matches the commented out part. How can make sure that doesn't happen?
Upvotes: 1
Views: 434