[fpc-pascal] CSV via PCRE

Graeme Geldenhuys graemeg.lists at gmail.com
Sun Nov 11 01:21:58 CET 2007

On 11/11/2007, S. Fisher <expandafter at yahoo.com> 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 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 code. Plus that unit has been well unit
tested as part of the hourly tests run by the tiOPF project.


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. Plus not everybody knows them (syntax wise), so it make
it hard for other developers to maintain that code. Implementing
something like a CSV parser in a more Object Pascal fashion goes more
with the style of the language (easy to read and understand) and is
much easier to maintain by others if needed.

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the fpc-pascal mailing list