LPeg: inserting previous captures by substitution

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

LPeg: inserting previous captures by substitution

Александр Машин
> Use this:
 > integer <- { int } int <- {~ digits spaces -> '' int / digits ~}
 > That gives you two captures, the first is the unmodified
 > (unsubstituted) match:
 > print(patt:match("6 000 000")) -->  6 000 000 6000000
Thank you, Mr Donnelly, but I am trying to do it with pure re, while
concatenating two captures will require outer Lua code.

I am looking for something like %1 in the second argument of string.gsub
(). For something like =name but usable after ->.

Alexander Mashin