[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPeg back captures
- From: Sean Conner <sean@...>
- Date: Wed, 23 Oct 2013 23:10:10 -0400
It was thus said that the Great Andrew Starks once stated:
> On Wednesday, October 23, 2013, Sean Conner wrote:
>
> > DIGIT = R"09"
> > delim_char = P"!" -- Cb("delim")
> > flags = P"i"
> > backref = P"\\" * DIGIT
> > escapeddelim = P"\\" * delim_char
> > anychar = P(1) - delim_char
> > string = (escapeddelim + anychar)^1
> > repl = C((string + backref)^0)
> > ere = C((P(1) - delim_char)^0)
> > idelim_char = Cg(P"/" + P"!" + (P(1) - (DIGIT + flags)),"delim")
> > regexp = Ct(
> > idelim_char
> > * Cg(ere,"re")
> > * delim_char
> > * Cg(repl,"replace")
> > * delim_char
> > * Cg(flags^0,"flags")
> > )
> >
> Crap, sorry. That was wrong. I mixed up the other half of it, which is Cg.
>
> Okay, first, I believe that you need to have your "delim" defined in a Cg
> before the back capture, which I didn't see. So
I do that---check the definition of regexp and idelim_char.
-spc (Still puzzled)