关于使用grep
进行有关懒惰匹配的previous question后续跟进,我对sed
提出了类似问题:
假设我有以下文本文件(名为test.txt
):
\centerline{\includegraphics[width=0.50 \columnwidth]{example_graph.pdf}}
\centerline{\includegraphics[width=0.5 \columnwidth]{coarse_grain_illustration.png}}
\centerline{\includegraphics[width= 0.8 \columnwidth]{1y26_energy_dists.pdf}}
如果我跑:
$ sed -r 's/\\includegraphics.*?}//g' test.txt
\centerline{
\centerline{
\centerline{
然后它一直匹配到最后一个花括号。它应该与第一个不匹配吗?