Quote:
Originally Posted by WJSwanepoel
Eg. A sentence that reads: Vergelyk Hand. vii. 12, en die ook by v. 1.
"Hand." will appear in my list but "by" will not. So it needs to convert to:
Vergelyk Hand. 7:12 en ook by v. 1.
|
As coded, that example won't be converted at all, since the numbering format is not as you described, which had a roman numeral, followed by a period, space
single digit, period (which was to be deleted). The code looks for and processes only the specific sequence you described. Even allowing for multiple digits and no period, via:
Code:
.Text = "[A-Z][a-z]{1,3}. [iIvVxXlLmMcCdD]{1,}. [0-9]@>"
your second expression would not be processed, since it lacks the starting capital.
If there remains a risk of false matches, you could replace:
Code:
.Text = Split(.Text, ".")(0) & ". " & _
Roman2Num(Trim(Split(.Text, ".")(1))) & _
":" & Trim(Split(.Text, ".")(2))
with:
Code:
If InStr("|Bob|Hope|", "|" & Split(.Text, ".")(0) & "|") > 0 Then
.Text = Split(.Text, ".")(0) & ". " & _
Roman2Num(Trim(Split(.Text, ".")(1))) & _
":" & Trim(Split(.Text, ".")(2))
End If
where "|Bob|Hope|" is your set of valid abbreviations, each bounded by a | character.