lua-users home
lua-l archive

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


what does ".*?" mean? .* is any character zero or multiple times and
what does the ? add?

Examples are examples. Real code is different. Anywhere they use short
names for example code. A rule of thumb is the broader the context the
more descriptive the name. Local variables can be short.

lua derived itself from a data description language. do you really
need xml? how about sandboxed lua code?

Kind regards,

On Thu, Dec 16, 2010 at 4:04 PM, Yehuda Eisenstark
<yudieisenstark@gmail.com> wrote:
> I have a variable that contains text over multiple lines, e.g.:
> local string = <part>
>                       15234234
>                     </part>
> When there are no spaces / new lines in the string a simple rex.match, like
> the following works:
> local number = rex.match(string, "<part>(.*?)</part>")
> But once there are new lines the regex breaks, even when I add .* to the
> regex. How can I parse out text on multi-line searches?
> Thanks,
> Also as an aside, as I'm new to Lua. In other languages I've always tried to
> use very descriptive variable names. In a lot of the lua examples I've seen,
> variable names are extremely short, like one letter. Is this just a matter
> of style or are there good reasons to use shorter variable names?
> Y