[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: multiline rex.match
- From: Philippe Lhoste <PhiLho@...>
- Date: Thu, 16 Dec 2010 17:57:56 +0100
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
-- -- -- -- -- -- -- -- -- -- -- -- -- --