lua-users home
lua-l archive

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


2013/3/18 Laurent Faillie <l_faillie@yahoo.com>:
> Thanks to both of U : it's working very well thank you :)
>
> But I still don't understand why my "(%a.+)" didn't work and extract the
> remaining of the line.

The culprit is .+, it will mean it will match one or more of any
characters. The + pattern is greedy, it will match as many characters
as possible. And that means it will match the whole input string in
the first gmatch match, rather than iterate over smaller parts like
you expected. You need to replace .+ with .- in your initial pattern.