lua-users home
lua-l archive

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


i found 'cunning', 'nifty' ( www.linguee.com ) for your solution ..ö.. (hope it tells what i want to express)

2011/5/16 Philippe Lhoste <PhiLho@gmx.net>
function test(line)
 a, b, c = string.match(line, '^# (%d+)%.?(%d*)%.?(%d*)')
 print(a, b, c)
end

test "# 4515.65545.42"
test "# 4515.65545"
test "# 4515"

There is probably a gotcha (false positive on some input? like # 5454.), but might work well enough for you...


--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --