I'm trying to do a replace using regex, and I'm horrible at writing the correct syntax. I want to replace the phrase
"Restricted Internal Use Only". There can be spaces or returns as the whitespace because it could land on multiple lines, and I'm searching for the string in the HTML body of an outlook messsage (pulled into a string), so there could be spaces or tags before or after the phrase...
Here is what I have right now...
Does anyone have any thoughts on how to make this work?
"Restricted Internal Use Only". There can be spaces or returns as the whitespace because it could land on multiple lines, and I'm searching for the string in the HTML body of an outlook messsage (pulled into a string), so there could be spaces or tags before or after the phrase...
Here is what I have right now...
Code:
Function StripText(ByVal theBody As String) As String
Dim RegEx As Object
Set RegEx = CreateObject("vbscript.regexp")
With RegEx
.Global = True
.IgnoreCase = True
.MultiLine = True
.Pattern = "^(RESTRICTED\s+INTERNAL\s+USE\s+ONLY)$"
End With
StripText = RegEx.Replace(theBody, "--------------------")
Set RegEx = Nothing
End Function
Does anyone have any thoughts on how to make this work?