Requires universal CSV parser by specification RFC 4180. There is the csv file, with all the problems of the specification:
Excel opens the file as it is written in
I would say, forget about regex. CSV can be parsed easily by TextFieldParser class. To do that, you need to be
using Microsoft.VisualBasic.FileIO;
Then you can use it:
using (TextFieldParser parser = new TextFieldParser(Stream))
{
parser.TextFieldType = FieldType.Delimited;
parser.SetDelimiters(",");
while (!parser.EndOfData)
{
string[] fields = parser.ReadFields();
foreach (string field in fields)
{
// Do your stuff here ...
}
}
}