lua-users home
lua-l archive

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


Hi list,

I'm working on lunicode (under development now), and I take out
Lua5.2.1's lstrlib.c and modify/refactor it (to fix support unicode).

when i'm adding unicode support in match, I have a idea.

now Lua don't support ?,*,+,- on a so-called sub-pattern, but from the
source, to add this support is easy: we can add a special %r (means
recurse) modifier, so as:
("catcatcat"):match "%r(cat)+"
returns
catcatcat

the idea is call match repeatly with sub-pattern on subject. all
captures in %r sub-pattern is dropped. only use it to match
multi-pattern in pattern.

has someone interesting it? or is it a good idea about Lua5.3/6? hope
for your comments :-)

--
regards,
Xavier Wang.