Re: lua regex question
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: lua regex question
- From: andreas graeper <agraeper@...>
- Date: 2011年5月16日 15:08:39 +0200
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
-- -- -- -- -- -- -- -- -- -- -- -- -- --