Hi Michael,
If we wants to split the string into substring. We will use the split
function, which is also a static function of RegEx function.
Dim strInputString As String = "2:Blue:Green:1,2"
For Each str As String In Regex.Split(strInputString, ":")
Debug.WriteLine(str)
Next
Here the regex pattern is the :, the regex will match the pattern in the
second parameter of the Split method and then split the string from that
position.
Also we can use the regex to match the substring which did not contain :,
which seems to be an indirect thinking.
Dim strPattern As String = "[^:]+"
For Each mt As Match In Regex.Matches(strInputString, strPattern)
Debug.WriteLine(mt.Value)
Next
Here is a link about the special character in regex for your reference.
Character Classes
http://msdn.microsoft.com/library/de...us/cpgenref/ht
ml/cpconcharacterclasses.asp
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.