lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Jul 24, 2015 at 2:45 PM, Александр Машин <alex.mashin@gmail.com> wrote:
> But what if I want to return "6000000|6 000 000"? Can I memorise the
> original capture, before removing the spaces and insert it by substitution
> after processed string? I mean, can I do it with pure re syntax, without
> function captures?

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

-- 
Patrick Donnelly