Dear Customer,
From you description, I understand that you want to merge two regular
expressions into one.
If I misunderstood, please feel free to let me know.
Based on my research, we can run the code snippet below to achieve your
goal.
'<code snippet>
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim s As String = "Test" & vbCrLf & "Test1 T" & vbCrLf &
"Test2"
Dim myEvaluator As MatchEvaluator = New MatchEvaluator(AddressOf
ReplaceCC)
MsgBox(s)
MsgBox(Regex.Replace(s, "[\x0A\x0D]|\s{2,}", myEvaluator))
End Sub
Public Function ReplaceCC(ByVal m As Match) As String
If m.Value = Chr(&HA) Or m.Value = Chr(&HD) Then
Return ""
Else
Return " "
End If
End Function
'</code snippet>
You may have a try and let me know the result.
Note: Commonly we suggest simplifying the regular expression to make the
code more maintainable. If we divided a complex regular expression into a
few simpler ones, the logic will be more clear and lucid.
If you still have any concerns, please feel free to let me know.
I look forward to hearing from you.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.