How to use Regex Replace to conditionally remove blocks of text?
Posted
by lauren meyers
on Stack Overflow
See other posts from Stack Overflow
or by lauren meyers
Published on 2010-05-05T01:48:32Z
Indexed on
2010/05/05
1:58 UTC
Read the original article
Hit count: 467
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
© Stack Overflow or respective owner