我有以下多行字符串:
asd \cite[1][2]{foo, bar} asdf \cite{baz, bar}
foo \citet{lorem} % \cite{asd}
foo \citep{ipsum}
\citep{dolor, sit,
amet}我想匹配花括号内的所有内容(包括dolor, sit, amet),但如果它被注释掉了(在%之后),就不匹配了。我不知道注释后面是什么-它可能是任意数量的空格或字符。我目前使用的正则表达式如下:
\\cite[tp]?\s*\[?.*?\]?\s*\{(.*?)\}.*?这也与注释掉的部分相匹配。如何才能确保这种情况不会发生?
发布于 2015-05-22 06:39:43
https://stackoverflow.com/questions/30385432
复制相似问题