lua-users home
lua-l archive

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


Op Sa. 11 Mei 2019 om 09:12 het Jim <djvaios@gmail.com> geskryf:
>
> On 5/10/19, Sean Conner <sean@conman.org> wrote:
> > There are at least three modules providing regex in Lua available via
> > LuaRocks: Lrexlib-POSIX, Lrexlib-PCRE (most popular) and Lrexlib-PCRE2.
> > There's also at least two POSIX modules: lposix and luaposix (most popular).
> > There *is* a solution, it's just not a built-in one.
>
> see ? this is exactly the problem, Sir.
> everybody reinvents the wheel again and again instead of combining
> efforts and put a decent solution into the Lua std lib for FREE,

That's Lua users for you. They love reinventing the wheel. Mind you,
sometimes they come up with shiny mags fitted with Pirellis.

> i. e. add such functionality to the "os" table where it in fact belongs.

In the case of regex, it belongs in the string library, but I don't
support pulling in regex. It is a an old-fashioned, human-unfriendly
solution to a simplified string matching problem. Its only advantage
is that many non-Lua people already have a love-hate relationship with
it.

The Lua solution is two-pronged:
(a) for everyday use, the string matching library is concise and easy;
(b) for complex parsing-type applications, load LPEG. Besides being a
Lua-ish extension, it is more powerful than regex.