Here's my code:
Dim regEx As Object, strPattern As String, s_document As String
Dim new_string As String, sreturn As String
Set regEx = CreateObject("vbscript.regexp")
With regEx
.Global = True
.MultiLine = True
.IgnoreCase = False
End With
s_document = ActiveDocument.Content.Text
regEx.Pattern = "(-- )([A-Z])"
ActiveDocument.Content.Text = regEx.Replace(s_document, "$1\l$2")
The sample text I have is as follows:
This is a -- A dog jumped over the moon -- actually this dog jumped over the moon -- No, this one.
So from this code I'm trying to replace "-- A" with "-- a" and so on with the entire alphabet. My current result:
a -- \lA
So the flag \l isn't converting $2 to lowercase. Any guidance on this would be great. And as an extra, is there something I could throw in there to ignore if it's just "I" and to leave that as uppercase? Main goal is just to get the lowercase conversion working first.
TYIA.