Re: [fpc-pascal] CSV via PCRE

2007-11-12 Thread Jeff Wormsley
S. Fisher wrote: Regular expressions are used by vi and emacs; in fact, any editor that doesn't let you do a regex search is a joke. (Even some microsoft applications understand regexes.) So everyone who programs should learn regular expressions. Regular expressions are also used by grep, an

Re: [fpc-pascal] CSV via PCRE

2007-11-11 Thread Florian Klaempfl
> Regular expressions are used by vi and emacs; in fact, any editor that > doesn't let you do a regex search is a joke. (Even some microsoft > applications understand regexes.) So everyone who programs should > learn regular expressions. I can write regexs and decypher them, I even being guilty

Re: [fpc-pascal] CSV via PCRE

2007-11-11 Thread Marco van de Voort
> > But if you insist, I can give you a full running application. My > > point was that regular expression are normally a nightmare to debug > > and maintain. > > I don't think so. > > > Plus not everybody knows them (syntax wise), > > Not everyone knows how to tie his shoelaces. Not everybody

Re: [fpc-pascal] CSV via PCRE

2007-11-11 Thread Bee
Not everyone knows how to tie his shoelaces. One who doesn't tie his shoelaces doesn't mean he doesn't know how to do it. ;) Regular expressions are no more against the spirit of Pascal than associative arrays (hash tables) or any other feature that is added by using a unit. http://z505.co

Re: [fpc-pascal] CSV via PCRE

2007-11-10 Thread S. Fisher
--- Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > The code shown in the url below works just fine. Also the usage sample > is all you need to use the tokenizer. Just replace the FieldSpecLine > variable with the content from a CSV file and you are good to go. I > use it as-is in my production c

Re: [fpc-pascal] CSV via PCRE

2007-11-10 Thread Graeme Geldenhuys
On 11/11/2007, S. Fisher <[EMAIL PROTECTED]> wrote: > > That's not a working sample. It has no CSV record to parse. > > Give a working program that we can run with no modifications > whatsoever; parse an actual CSV record; print every field > in the record. That's what my sample did. The code s

Re: [fpc-pascal] CSV via PCRE

2007-11-10 Thread S. Fisher
--- Graeme Geldenhuys <[EMAIL PROTECTED]> wrote: > OK, while we are busy with show-and-tell... Then have a look at my > token library implementation. > > http://tinyurl.com/395vgp > > Sample Usage: > > tokenizer := TTokens.Create(FieldSpecLine, ', ', '"', '"', '\', > tsMul

Re: [fpc-pascal] CSV via PCRE

2007-11-10 Thread Micha Nelissen
Graeme Geldenhuys wrote: > OK, while we are busy with show-and-tell... Then have a look at my > token library implementation. You've implemented some kind of 'cut'. But grep is also very useful (and more often used in a shell, at least by me). Micha ___

Re: [fpc-pascal] CSV via PCRE

2007-11-10 Thread Graeme Geldenhuys
OK, while we are busy with show-and-tell... Then have a look at my token library implementation. http://tinyurl.com/395vgp * It's based on a Infinite State Machine. * No external units required. * Allows multiple separators (user selectable) between tokens. * Allows for user selectable sepera

[fpc-pascal] CSV via PCRE

2007-11-09 Thread S. Fisher
Fields are separated by commas, but if a field is surrounded by double quotes it can contain commas---in fact, can contain any byte whatsoever; double quotes (") within the field must be doubled, just as single quotes within a Pascal string are doubled. All we need in order to parse a csv record