本人现需进行特定内容的更换,如:“Form No. : wwes-213-20”,想实现末尾数字的+1(Form No. : wwes-213-21),现已通过通配符的方式查找替换,查找“([F,f]*No*-[0-9]{1,3}-)20”,替换“\121”
待替换的内容.zip
(9.88 KB, 下载次数: 16)
但此方式只能以穷举法的形式,穷举末尾的数字来替换,想请教各位大佬是否有更好的方式来完成这个效果。
以下为我的部分穷举代码
With Selection.Find .Text = "([F,f]*No*-[0-9]{1,3}-)08" .Replacement.Text = "\109" .MatchWildcards = True '启用通配符匹配 End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "([F,f]*No*-[0-9]{1,3}-)07" .Replacement.Text = "\108" End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "([F,f]*No*-[0-9]{1,3}-)06" .Replacement.Text = "\107" End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "([F,f]*No*-[0-9]{1,3}-)05" .Replacement.Text = "\106" End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "([F,f]*No*-[0-9]{1,3}-)04" .Replacement.Text = "\105" End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "([F,f]*No*-[0-9]{1,3}-)03" .Replacement.Text = "\104" End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "([F,f]*No*-[0-9]{1,3}-)02" .Replacement.Text = "\103" End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "([F,f]*No*-[0-9]{1,3}-)01" .Replacement.Text = "\102" End With
|