I am attempting to extract all data from a file with one regex expression. Since there are optional(?
,*
) and repitious(*
,+
) expressions, it would be difficult to enumerate through the captures, at least in a readable and understandable fashion. Therefore, I am using named groups. However the data is in an XML like structure; neseted elements can have complex elements. So I am using nested name groups. However, one I have captured a group, how do I retrieve the nested groups by name?
Dim mtch = System.Text.RegularExpressions.Regex.Match(fullText, _
"\s+(?<PolyID>\d+)" & _
"\s+(?<Center>" & _
"(?<LAT>\-?\d\.\d+E\+\d{2})" & _
"\s+(?<LON>\-?\d\.\d+E\+\d{2})" & _
")\n(?<Point>\s+" & _
"(?<LAT>\-?\d\.\d+E\+\d{2})" & _
"\s+(?<LON>\-?\d\.\d+E\+\d{2})" & _
"\n)+END\n", _
System.Text.RegularExpressions.RegexOptions.Singleline)
I am trying to get the
mtch.Group("Center").Group("LAT").Value
How can I retrieve named subgroups of the current group?