我得到了與圖壞引用一個巨大的LaTeX的文件,正則表達式替換,例如它說發現並輸出
"... So in the figure 3-12 we see ... similar to figure 3-1..."
,它應該是
"... So in the figure \ref{fig:3-12} we see ... similar to figure \ref{fig:3-1}..."
爲了節省時間,我傻,我因子評分查找/替換,如:
發現:figure 3-
取代:figure \ref{fig:3-
其中返回:
"... So in the figure \ref{fig:3-12 we see ... similar to figure \ref{fig:3-1..."
現在右括號
sed 's#/ref{fig:3-\d+#\ref{fig:3-\d+}#g' main.tex
這將產生
"... So in the figure \ref{fig:3-\d+} we see ... similar to figure \ref{fig:3-\d+}..."
什麼是錯的朋友?謝謝。
您正在匹配文本中的每個\ d + - \ d +'。使圖形成爲你圖案的一部分。 –