[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: builtin pattern matching
- From: Jim <djvaios@...>
- Date: Sat, 11 May 2019 10:00:12 +0200
On 5/10/19, Sean Conner <sean@conman.org> wrote:
> Well, MS-DOS and AmigaOS spring to mind.
i am pretty sure lots of Lua code runs on DOS and AmigaOS these days,
hence still supporting those is crucial indeed. :D
> I never liked regex. Ever. I find them exceedingly hard to
> understand as they devolve into line noise in my opinion. Not only do I
> find them hard to read, but you can't combine them (unlike LPEG, which you
> can easily build up piecemeal and combine---very nice).
that may be true, but coders used to Perl, Ruby (these 2 even provide regex
syntax as part of their own syntax) et al are used to pattern matching
with regex,
so it would be nice if Lua could provide some decent builtin form of
regex pattern matching (at least as lib, wasting extra syntax for
regex is not necessary IMO but maybe it is even possible via a
metatable).
maybe it would also be useful to just have builtin simple shell style
pattern matching
(*, ?, [...]) for simple patterns, though this can be done already
with Lua's patterns.
this is frequently used for file path matching via glob() and friends
and has to be
provided by any posix conforming libc.
all the user asked for back then was the addition of an OR '|' operator to Lua's
builtin patterns (which saves one from using if-then-else for all
possible pattern
alternatives).