LuLPeg 是一个纯 Lua 实现的 LPeg 移植版本,LPeg 是 Roberto Ierusalimschy 的解释表达式语法库。
示例代码:
local lulpeg = require"lulpeg" local re = lulpeg.re -- from here use LuLPeg as you would use LPeg. pattern = lulpeg.C(lulpeg.P"A" + "B") ^ 0 print(pattern:match"ABA") --> "A" "B" "A"