Column select with RegEx
Hi. I was wondering if someone could help me out with RegEx.
Lets say I have a text file with the following contents:
ABC CDE FGH JJJ
123 456 789 000
What would the regex pattern be to get a specific column. For example, if I wanted to get column three, the matches collection returned by regex would be as follows:
Match[0] = "FGH"
Match[1] = "789"
Help is much appreciated. Thanks.
# 1 Re: Column select with RegEx
I don't know if that's possible. I would simply use the Split function to return all the columns, then access the desired column by its array index, e.g.:
Dim Line1 As String = "ABC CDE FGH JJJ"
Dim Line2 As String = "123 456 789 000"
Dim Names() As String = Split(Line1)
Dim Values() As String = Split(Line2)
' Column 3 name = Names(2)
' Column 3 value = Values(2)