lua-users home
lua-l archive

LPeg: inserting previous captures by substitution

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


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

AltStyle によって変換されたページ (->オリジナル) /