[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua patterns
- From: "Soni L." <fakedme@...>
- Date: Sun, 26 Jul 2015 20:24:14 -0300
Lua patterns are too complex.
^[^()]?([a-z]-$.*)$
^ was repeated twice, with 2 different meanings
$ was repeated twice, again with 2 different meanings
[] was repeated twice, although with the same meaning
( was repeated twice, with 2 different meanings
- was repeated twice, with 2 different meanings
+ - * and ? can be simplified to + - and ? (PCRE has + * +? *? ? which
can also be simplified to + - and ?, and technically ? is not needed)
In my opinion, that's a lot of (unnecessary) special-casing. Is there
any way Lua could eliminate all of that?
(I've been working on a Lua-pattern-like matcher called "ClEx"[1] which
aims to make it simple enough to parse (you can even parse it
iteratively!) but powerful enough to be comparable to regex - to the
point where you can write any regex with ClEx, but you can't write any
ClEx with regex)
[1] https://gist.github.com/SoniEx2/36d2ccf875ea025c8fe5
--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.