3 ms·
The Lua pattern-matching code he mentions is here (http://www.lua.org/source/5.1/lstrlib.c.html#match http://www.lua.org/source/5.1/lstrlib.c.html#match). You c
by silentbicycle 16y ago
The Lua pattern-matching code he mentions is here (http://www.lua.org/source/5.1/lstrlib.c.html#match http://www.lua.org/source/5.1/lstrlib.c.html#match). You can browse the overall source (http://www.lua.org/source/5.1/ http://www.lua.org/source/5.1/) online, too.
The Lua standard string library includes a minimalistic regex implementation - it doesn't have full REs because the implementation would probably be larger than the rest of Lua (!).
For situations where you're better off with a real parser and not just REs, LPEG (http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html) is available as a library. It's a bit different from both REs and LL(k) / LALR(k) parser generators (it's a PEG variant), but works quite well in my experience - while designed with parsing in mind, it scales down quite nicely to typical RE string stuff.
- deleted 16y ago[deleted]