The code below works find to achieve the results below; however, it does not change just the selection. It changes other areas of the document which I don't want touched.
Each line in the before is a line with a paragraph mark at the end of each line.
Before
A2.3. Walk the dog A2.3.4.5. Feed the dog A2.3.4. Bath the dog
A2.3. Walk the Cat A2.3.4.5. Feed the Cat
After
A2.3. Walk the dog
A2.3.4.5. Feed the dog
A2.3.4. Bath the dog
A2.3. Walk the Cat
A2.3.4.5. Feed the Cat
After all the paragraph marks are inserted, each line with begin with A2. if that makes a difference.
Code:
Sub FixReferences1()
Dim oRng As Range
Set oRng = ActiveDocument.Range
With Selection
With oRng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Font.Bold = False
.Text = "[ ^s^t](<[0-9A-Z]{2,})"
.Replacement.Text = "^p\1"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
End With
End Sub