How to use Regex Replace to conditionally remove blocks of text?
- by lauren meyers
I would like to conditionally remove a block of text between specifed start and stop delimiters. The code below does not work, but hopefully it suggests enough of what I am trying to accomplish.
If dr("ReferralPoints") > 0 Then
Dim objRegex As Regex = New Regex("[HASNOVALUE:REFERRALPOINTS](.*)[/HASNOVALUE:REFERRALPOINTS]", RegexOptions.IgnoreCase + RegexOptions.Singleline)
Dim result As String = objRegex.Replace(strBody, "")
End If