lua-users home
lua-l archive

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

2013/5/22 Petite Abeille <>:

> Well, in that specific case, I was explicitly looking for a plain Lua
> string pattern… no other third party required

Like most of Lua, the string matching library is designed to what
it does very intuitively. Anything that can be written in terms of
character classes (strictly, byte classes) works more easily with
Lua patterns than with anything else I know. It's perfect as a compact
string library in a small language.

But concepts like repeated letters, or searching among any of several
multi-byte sequences (such as UTF-8 characters) do not form part of
its design. One is forced into tricks such as mapping commonly used
UTF-8 sequences into bytes (isn't that just re-inventing ISO-8859 for
oneself?). I have been flamed on this list for being sloppy enough not
only to do it myself but having the gall to show the quick-and-dirty trick
as if it was something to be proud of. Marc: you were right. At the time
I was deeply offended, but you were right.

I have come to the conclusion that in such cases, it shows respect for
the elegance of the Lua string library to use a more appropriate tool
rather than forcing the pretty little dachshund to jump through loops.