VBA MS-Word: Is it possible to replace text with wildcard?

后端 未结 2 854
南笙
南笙 2021-01-17 02:18

Is it possible to replace the text that was found using wildcard and replace it with wildcard also? for example FindText:=\"(^13{2}*^13)\", Forward:=True, MatchWildcar

2条回答
  •  -上瘾入骨i
    2021-01-17 02:31

    The entire discussion in Comments is unclear, but I understand that you need to replace only part of the search term, and retain another part. Yes, that's possible by defining expressions in the search term. For example:

    Find: "(^13{2}*)^13" Replace: \1^11

    An expression is defined using parentheses. You can have multiple expressions in the "Find" text. Refer to an expression and have Word use it in the replacement using backslash+index, where index is the number (location) of the expression in the Find text. In the above example, taken from your question, there is one expression, so \1.

提交回复
热议问题