lua-users home
lua-l archive

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


Andreas Stenius wrote:
I have a feature request for the string library.
When matching sets, I've come across the whish to match the end of the subject, as an alternative in a set, so putting the $ last doesn't work, since I want it inside the set, which currently doesn't work.

I am not sure to understand fully.
You want to write something like "foo([\r\n]|$)"?
It isn't possible with the standard string library, because the regex engine is simple and doesn't support alternatives. It won't be improved toward this goal (it would need a very different algorithm, much bigger), so you would need either more code around the matching code (like I did in a parser) or to use a third party regular expression library (there is a PCRE binding).

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --