我发现这个blog谈论的是匹配LaTeX
内嵌的$..$
内联数学。建议的模式\$.*?\$
可以很好地工作并与任何内联数学表达式匹配,我很惊讶如此紧凑的模式如何捕获如此广泛的表达式。
\$
匹配两个文字美元符号.*
零个或多个字符?
看着上一步中的“零个或多个”,尝试尽可能少地匹配字符,同时仍然使该模式成功匹配某些东西\$
与另外两个文字美元符号匹配
我知道每个单独的匹配模式都可以做什么,但是我不知道.*?
是如何完成这项任务的。
例如,在以下文本中:
We try to quantitatively capture these characteristics by defining a set of indexes, which can be computed using the mosaic image and the corresponding ground truth:
\begin{itemize}
\item $\mu_{A_T}$ and $\sigma_{A_T}$, the mean and standard deviation of the tiles area $A_T$, respectively;
\$.*\$
将单个匹配项查找为以下内容,但无法找到三个内联数学表达式:
$\mu_{A_T}$ and $\sigma_{A_T}$, the mean and standard deviation of the tiles area $A_T$
\$.*?\$
将正确匹配每个单独的内联数学:
$\mu_{A_T}$
$\sigma_{A_T}$
$A_T$
有人可以帮助我理解为什么将?
添加到.*
会有助于正确地找到内联LaTeX数学吗?