[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LPeg question: parsing CSV
- From: "Ken Smith" <kgsmith@...>
- Date: Fri, 16 Nov 2007 22:15:51 -0800
On Nov 16, 2007 3:52 PM, Duncan Cross <firstname.lastname@example.org> wrote:
> On Nov 16, 2007 11:33 PM, Ken Smith <email@example.com> wrote:
> > On Nov 16, 2007 1:04 PM, Duncan Cross <firstname.lastname@example.org> wrote:
> > > > In the second case, I expect to receive a table from the match but get
> > > > only the first field as a string.
> > >
> > > You should use lpeg.Ct instead of lpeg.C for this.
> > Thanks for the response. When I change
> > lpeg.C((1 - lpeg.S',\n"')^0)
> > to
> > lpeg.Ct((1 - lpeg.S',\n"')^0)
> > I get a table from record:match but the table is empty. Is this not
> > what you meant?
> Sorry, my fault, I misread - try putting lpeg.Ct( ... ) around the
> following bit of record_lpeg, instead:
> field * (',' * field)^0
Beauty. That does the trick. Thank you.