Loading data from a RegEx Match into specific ListBox Columns

It’s been a little bit since I worked on this project and now that I’m back at it I’m stuck again.

If I have a group of data returned from a regex search, how would I go about having that data display in a listbox, but in a certain order?

//Regex stuff
myMatch = rg.Search(s)

//display results in listbox
lstBoxImages.AddRow ""  

while myMatch <> nil
  lstBoxImages.Cell(0, colCount) = myMatch.SubExpressionString(2)
  myMatch = rg.Search
  colCount = colCount + 1      

This is working, but it’s not in the order I want it.

myMatch = rg.Search( s )

if myMatch <> nil then
  dim lb as Listbox = lstBoxImages // Convenience
  lb.AddRow ""
  dim row as integer = lb.LastIndex
  for subGroup as integer = 1 to myMatch.SubExpressionCount - 1
    dim col as integer = subGroup - 1
    lb.Cell( row, col ) = myMatch.SubExpressionString( subGroup )
  next col
end if

Thanks for replying (yet again) @Kem Tekinay
I get the following error with that code ^

::The Next variable (col) does not match the loop’s counter variable (subGroup)::

Ah, change the next to last line to simply “next”.

Hmmm. It now only displays 2 items in the 8-column listbox

There are only two subgroups in the pattern you specified.

Correct - but the code I originally had produced these results:
Nevermind - I can’t post a photo.

Only 2 of the columns get filled with data with what you gave me. Whereas before, every column was filled.

Then I misunderstood your requirements.

Basically, I have my listbox setup with columns in a certain order. I want the mdls data to be returned in the same order as the table, but it comes back in alphabetical order according to the mdls calls.
So I’m trying to figure out how to get that data returned in the order that I need it.
If that makes sense.