Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

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.
[445 byte] By [Tony Lintunen] at [2007-11-11 7:55:45]
# 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)
Phil Weber at 2007-11-11 21:48:13 >