Extract Ienumerable <match> object to a data table

I have red a unstructured text file by regex. I used regex to find values for each column like name, last name, date, etc. Each of them saved as ienumerable variables. Now I want them to iterate through the text file and save in a data table and extract them in a excel file. But I do not know how to do that, specially with ienumarable data. Can you please suggest a way?

ienumerable is just a read-only list of objects. If it is an ienumerable<match> that means you have a read-only list of match objects https://docs.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.match

If you want the text from the match you found, then that is found as part of the .Value() property of your match object.

I’m a little uncertain of what your current variables and situation is. You have multiple ienumerable variables and you want each match to be saved as part of a datatable? Is each ienumerable a single row? Is each ienumerable a single column? I don’t really understand what your current inputs and expected outputs look like

1 Like

Hi Dave,
Thanks for your reply. I actually able to save my ienumerable variables in a excel file. But Now I have another stuff to figure out.
So, I have two ienumerable vars, One is EndDate and another is Status. The condition is, if EndDate var has a blank cell value then Status should be “Y”, else Status should be blank.
I am trying to write a IF/THEN logic for that but I am getting compilation error. Says,-’ string can not be converted to System.Collections.generic.IEnumerable(Of System.Text.RegularExpressions.Match)’ because ‘Char’ is not derived from ‘System.Text.RegularExpressions.Match’, as required for the ‘Out’ generic parameter ‘T’ in ‘interface IEnumerable(Of Out T)’.

Can you please help me to understand what this means and how to solve this issue?