In my experiments regarding word wrap I tried to use a regex. The simplest incarnation would be a regular expression that matches, say, 10 characters at a time. the code I used is:
local es = "(.{10})"
local cs = "Contrary to popular belief Lorem Ipsum is not simply random text"
local r = regexp(es)
local rs = r.capture(cs)
if (rs) {
foreach (index, value in rs) {
print(format("Match %02d: %s", index + 1, cs.slice(value.begin, value.end))+"\n")
}
}
but the output is just:
Match 01: Contrary t
Match 02: Contrary t
It seams that after the first match it doesn't create other matches... any idea?