Regex 正则表达式将文本中的数字替换为前导零
我有这样的多行文字Regex 正则表达式将文本中的数字替换为前导零,regex,pcre,delphi-2006,Regex,Pcre,Delphi 2006,我有这样的多行文字 ... somthing :FX1; somemore :FX22) and :FX33 (:FX7 plus :FX88) or :FX44\n this number is okay :FX100 i like it ... ... somthing :FX001; somemore :FX022) and :FX033 (:FX007 plus :FX088) or :FX044\n this number is okay :FX100 i like it ...
... somthing :FX1; somemore :FX22) and :FX33 (:FX7 plus :FX88) or :FX44\n
this number is okay :FX100 i like it ...
... somthing :FX001; somemore :FX022) and :FX033 (:FX007 plus :FX088) or :FX044\n
this number is okay :FX100 i like it ...
结果应该是这样的
... somthing :FX1; somemore :FX22) and :FX33 (:FX7 plus :FX88) or :FX44\n
this number is okay :FX100 i like it ...
... somthing :FX001; somemore :FX022) and :FX033 (:FX007 plus :FX088) or :FX044\n
this number is okay :FX100 i like it ...
正则表达式替换应将前导零添加到所有小于100的数字
数字前缀为allway:FX
数字后面的后缀可以是空格、特殊字符、换行符等
编辑: 对我来说,它有两个替代品。 也许有人打开这个来寻求更好的解决方案
find1 = (:XF)(\d)([\D])
repl1 = ${1}00${2}${3}
find2 = (:XF)(\d\d)([\D])
repl2 = ${1}0${2}${3}
请在根据语言要求更改KingRegex之前进行尝试。请为您的编程语言添加语言标记。