lua-users home
lua-l archive

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


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