[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua regex question
- From: Philippe Lhoste <PhiLho@...>
- Date: Mon, 16 May 2011 14:48:51 +0200
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
-- -- -- -- -- -- -- -- -- -- -- -- -- --