VBA:
Execute WrapReplace
no documento do Word.
Sub WrapReplace()
Call RegExpReplace("(\w+)\-\s(\w+)", "$1-$2")
End Sub
Private Sub RegExpReplace(pattern As String, Backreference As String)
Dim strReplacement As String
Set oRegExp = CreateObject("VBScript.RegExp")
With oRegExp
.Global = True
.IgnoreCase = False
.pattern = pattern
End With
Set matches = oRegExp.Execute(ActiveDocument.Content)
For Each match In matches
Set matchRange = ActiveDocument.Content
strReplacement = oRegExp.Replace(match.Value, Backreference)
With matchRange.Find
.Text = match.Value
.Replacement.Text = strReplacement
.Wrap = wdFindAsk
.Execute Replace:=wdReplaceOne
End With
Next
End Sub