lua-users home
lua-l archive

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


On 16/12/2010 16:58, Shmuel Zeigerman wrote:
In Lua, ".-" is the equivalent to Perl's ".*?". There's no equivalent to /m though. But
you can use PCRE in Lua with Lrexlib [1].

The question is about rex.match, which, I suppose, already refers to this library.

On 16/12/2010 16:11, Axel Kittenberger wrote:
> lua derived itself from a data description language. do you really
> need xml? how about sandboxed lua code?

Sometime, XML comes from outside, you can get it with LuaSocket, etc.

But parsing XML with regular expressions is generally a bad idea, except perhaps for very short snippets as Yehuda shown. Using a proper XML library (there are many for Lua) is nearly always better.

Yehuda, the manual shows we can provide "ef", execution flags, like PCRE_MULTILINE or PCRE_DOTALL, to most methods.

About short identifiers: I think it is an habit from C coders, from old times where identifiers were limited to 8 chars at most (by the underlying assembly language, often)...
And it is faster to type with old editors (autocompletion reduces this need).
Also, and I tend to agree, functional programmers say that short variable names are OK in short functions, and are close of mathematical notation. But I think long function names are better and I avoid abbreviations in general, as they can be ambiguous. Except the most obvious/common abbreviations like min/max - even if the first one can stand for minutes...

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