David Boland

David Boland

  • NA
  • 11
  • 0

Parsing a strange text string...

Mar 9 2010 2:22 PM
I need some assistance in parsing the following string:

(555)555-55555,"[email protected]","20033","CITY OF BEZUCHA","555 MAIN STREET\n
PO BOX 55\n
BEZUCHA AL 55555-5555\n
\n
","","  $85730.93",19 NOV 2009,23 NOV 2009, " (I)INV0908763  CUSTOMER#116                    11/01/09   $8907.88 \n
 (I)INV0908993  CUSTOMER#116                    11/01/09     $12.61 \n
 (I)INV0908992  CUSTOMER#116                    11/01/09    $405.72 \n
 (I)INV0909222  CUSTOMER#116                    11/05/09  $76344.80 \n
 (I)INV0909406  CUSTOMER NO: 116                11/12/09     $59.92 \n
"\r\n


As you can see, it is comma delimted with some fields having quotes around them. Some fields such as the address and invoices can have more than one line in them, thus the line feeds need to stay.

I've tried using Regex, but for some reason, empty fields are ignored.

Thanks in advance for any assistance or guidance you can provide.

Answers (5)