[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LPeg for CSV parsing
- From: "Ken Smith" <kgsmith@...>
- Date: Fri, 31 Oct 2008 13:41:57 -0700
On Thu, Oct 30, 2008 at 9:37 AM, Roberto Ierusalimschy <firstname.lastname@example.org> wrote:
> In the definition for field that I use every day, where the value forThe lpeg.Cs substitutes single quotes for double quotes, therefore
> field has this,
> lpeg.Cs(((lpeg.P(1) - '"') + lpeg.P'""' / '"')^0)
> I have lpeg.C instead of lpeg.Cs. I don't remember why I did this but
> it seems to work either way.
unescaping quotes. Try this example:
local ex1 = '"a ""field"" containing quotes",123,3.14,2.717'
Ah, thanks for the explanaation. I've added the lpeg.Cs to my parser.