Regex re = new Regex("((?
It works well except if there is a blank field. (i.e, two commas in a row, or two quotes in a row) I need it to return a blank string.
Any suggestions.
Sample text would be: there is a line feed at the end of each line and a carriage return/line feed after the header row and after each set of invoices.
Fax_#,Email,Supplier,Name,Address,Contact,Amount_Paid,System_Date,Deposit_Date,Invoice_Details
(555)555-5555,"[email protected]","20033","CITY OF SAU1","RANT STREET
2ND ADDRESS LINE
SAU WI 54783
",""," $85730.93",19 NOV 2009,23 NOV 2009, " (I)INV0908763 CUSTOMER#116 11/01/09 $8907.88
(I)INV0908993 CUSTOMER#116 11/01/09 $12.61
(I)INV0908992 CUSTOMER#116 11/01/09 $405.72
(I)INV0909222 CUSTOMER#116 11/05/09 $76344.80
(I)INV0909406 CUSTOMER NO: 116 11/12/09 $59.92
"
(555)555-5555,"[email protected]","20033","CITY OF SAU1","RANT STREET
SAU WI 54783
",""," $85730.93",19 NOV 2009,23 NOV 2009, " (I)INV0908763 CUSTOMER#116 11/01/09 $8907.88
(I)INV0908993 CUSTOMER#116 11/01/09 $12.61
(I)INV0908992 CUSTOMER#116 11/01/09 $405.72
(I)INV0909222 CUSTOMER#116 11/05/09 $76344.80
(I)INV0909406 CUSTOMER NO: 116 11/12/09 $59.92
"
(555)555-5555,"[email protected]","20033","CITY OF SAU1","RANT STREET
SAU WI 54783
",""," $85730.93",19 NOV 2009,23 NOV 2009, " (I)INV0908763 CUSTOMER#116 11/01/09 $8907.88
(I)INV0908993 CUSTOMER#116 11/01/09 $12.61
(I)INV0908992 CUSTOMER#116 11/01/09 $405.72
(I)INV0909222 CUSTOMER#116 11/05/09 $76344.80
(I)INV0909406 CUSTOMER NO: 116 11/12/09 $59.92
"
Sam HobbsPosted Feb 21, 2010, 4:50 PM
Sam HobbsPosted Feb 20, 2010, 8:20 PM
I am uploading a zip file with sample source code and a txt file with your data modified. I modified your data so that the linefeeds are "\r\n" instead. This shows you that it is easy to read the data into a DataTable, except you probably need to convert the linefeeds to something. The conversion is not as simple as converting all linefeeds, since you don't want to convert the linefeeds that are followed by a carriage return.
RujutaPosted Feb 19, 2010, 10:56 PM
http://www.regexlib.com/RETester.aspx
It'll give you exactly what you want....