Read a text file
Richard Gaskin
ambassador at fourthworld.com
Mon Jan 17 22:05:58 EST 2005
Andre Garzia wrote:
>... although I was quick to create a simple regex that
> would parse simple CSV, it would fail for many cases
Welcome to CSV. Microsoft doesn't even implement it consistently across
their own product line (differences in escaping, some using \" and
others "").
The post Alex made here a while back has held up well in beta testing
WebMerge 2.4, now in its third week of testing, and on CSV files from a
wide variety of sources.
I don't have the url offhand (in a bit of a rush this evening), but it
wasn't hard to find last time I looked it up.
Perhaps the best solution to CSV is to throw it in the trash and use
FMP's excellent tab-delimited format. Sadly, only FMP has evidenced the
wisdom of simplicity and consistency, but they've done a wonderful
thing: tabs are simply disallowed in data (as is common in DB UI's
anyway), and CRs in data are replaced with ASCII 11 (vertical tab).
Simple, sensible, lightning fast to parse -- after I munge CSV I use
that format internally in WebMerge for the rest of its operations.
--
Richard Gaskin
Fourth World Media Corporation
__________________________________________________
Rev tools and more: http://www.fourthworld.com/rev
More information about the use-livecode
mailing list