I have the following CSV file with this header:
AccountOwnerEmail PartnerName EnrollmentID Customer LicensingProgram Country Culture Issue
with lines like this:
v-dakash@catalysis.com,"HEY"? Tester, 12345789,"Catalysis", LLC., Enterprise 6 TEST, etc,etc ,etc
I have a method to separate the lines into the corresponding columns:
var columns = columnsRegex.Matches(line)
.Cast<Match>()
.Select(m=> m.Value.Trim('\"', '\'', ' ', '\t'))
.ToList();
Here's the definition for columnsRegex:
private static Regex columnsRegex = new Regex("\"[^\"]*\"|'[^']*'|[^,;]+");
My problem here is that for example the PartnerName content is being separated into 3 columns like "" "Hey" and "?Tester"
I know that the CSV escapes the double quotes with another double quotes. And I have already checked another posts similar to this that recomends to add the reference to Microsoft.VisualBasic but that is not working for me. Its there any other approach to take to correctly process the CSV content?