lua-users home
lua-l archive

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


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
--  --  --  --  --  --  --  --  --  --  --  --  --  --