Re: Parsing problem
- Posted by DB James <larch at adelphia.net> Aug 16, 2005
- 619 views
Patrick Barnes wrote: > > I have some finance data that my bank insists on lumping all together > into one field. A sample of the data is below: > > Visa Purchase 26DECThe Carss Park Super Carss Par > Non Stg/Bsa Atm Wdl Fee > Internet Deposit 05JAN23:11itamoney <SNIP> > Visa Purchase 31JANWorld Vision Of Aust Burwood E > Visa Purchase 28JANVodafone Chatswood > Visa Purchase 31JANWoolworths W1200 Eastwood > Tfr Wdl Bpay Internet 03FEB19:0311174893 Integral Energy > > Each line is a single field in the incoming .csv file. > Any suggestions on how to parse it? In most but not all cases, the > second 'column' starts at about the 29th element. Sometimes the date > is given, sometimes data and time, sometimes nothing. > > -- > MrTrick > ---------- Hi. It appears as if the second set of data in each line always begins with a number, so you have a basis for separation there, as well as the tabbing or spacing otherwise. (Question: are the wide spaces tabs originally? If so, that would make parsing easy.) Also the first part of the second set either ends with a number, or it ends with a three-letter word for the month, so this can create a "rule" for separation of the second set. It would be handy if the bank would provide a copy of their rules for generationg these lines (some techy deep in the bowels of the bank would know, but they may not let him/her out of the cage for public communication :^D ) --Quark