Replace 查找并替换记事本+中不在括号内的数字+;

Replace 查找并替换记事本+中不在括号内的数字+;,replace,find,notepad++,Replace,Find,Notepad++,我有一个Latex文档,看起来像 Hello, my figure \ref{figure1} has an ecuation $e=mc^2$ with a mass of 10.5Kg or 20.5 Kg. 我想使用siunitx包,所以我的目标是将文本转换为 Hello, my figure \ref{figure1} has an ecuation $e=mc^2$ with a mass of \SI{10.5}{Kg} or \SI{20.5}{Kg}. 我怎样才能找到任何带或

我有一个Latex文档,看起来像

Hello, my figure \ref{figure1} has an ecuation $e=mc^2$ with a mass of 10.5Kg or 20.5 Kg.
我想使用siunitx包,所以我的目标是将文本转换为

Hello, my figure \ref{figure1} has an ecuation $e=mc^2$ with a mass of \SI{10.5}{Kg} or \SI{20.5}{Kg}.
我怎样才能找到任何带或不带小数点的数字,后跟一个带或不带空格的单词。只查找那些不在{}或$$之间的。将匹配项替换为\SI{digit found}{digit}后的字

任何建议都是有益的。理想情况下使用记事本+,但开放使用Python,Sed

那么:

查找内容:
(?

替换为:
\\SI{$1}{$2}

谢谢,仍然可以找到与\ref{figure12ecuation}匹配的内容,但其余内容非常有用!请编辑以添加额外的反斜杠:\\SI{$1}{$2}@katutxakurra:您可以在数字之前添加单词边界
\b
,请参见我的编辑。我还添加了双反斜杠。