Assuming the following code:
[VB.Net]
Dim strPattern As String = "(\d{3})(-)(\d{4})"
Dim strMatch As String = "555-1234"
Dim regExp As New RegEx(strPattern)
Dim matches As MatchCollection = regExp.Matches(strMatch)
Dim match As Match = matches(0)
Dim groups As GroupCollection = match.Groups
Dim group As Group = groups(1)
Debug.WriteLine(group.Success, "group.Success") 'True
Debug.WriteLine(group.Index, "group.Index") '0
Debug.WriteLine(group.Length, "group.Length") '3
Debug.WriteLine(group.Value, "group.Value") '555
How do I get the actual text of the PATTERN representing the matched
group? I want the segment of the pattern, not the matched value so I
would like to see "(\d{3})".
Do I need to create a regular expression to parse my regular expression?
Ooh, that sounds ominous.
Sometimes the greatest solutions come from the simplest logic.
Being told "No" is merely the incentive to do it anyway.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!