I was looking to doing CSV parsing using regular expressions, but I came across one post in a newsgroup where it was stated that regular expressions themselves couldn't handle it alone. Because the environment I was working with had restricted regular expression capabilities and no third party package integration capabilities, I instead just went for the brute force method of parsing character for character on each line and using a state machine.
It seems to work very well, but the performance could be a little better. james -----Original Message----- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 25, 2005 7:01 PM To: Don Seiler Cc: Jakarta Commons Users List Subject: Re: CSV parsing/writing? Fair enough. I have parsed CSVs a number of times, I guess I've been lucky in that one of the design criteria was no occurances of the delimiter within data elements. Certainly if there is a chance of that, then sure, you need something more advanced. Frank Don Seiler wrote: > On 17:46 Wed 25 May , Frank W. Zammetti wrote: > >>I might be missing something, but doesn't StringTokenizer do the trick >>for you? > > > Anyone with experience parsing CSVs knows there are the cases of > delimiters within quotes that make the parsing a bigger headache than > just using StringTokenizer (or String.split()). Why else would there > be so many other third-party APIs for it? > > >>Don Seiler wrote: >> >>>Afternoon. Just writing to ask if anyone knows of any >>>commons/jakarta packages that may do CSV parsing and writing. I'm >>>aware of the jcsv package but thought I would try and utilize commons >>>as much as possible. I looked at jakarta-oro as well but don't seem >>>to see anything CSV related. >>> >>>Thanks in advance. > > -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
