lua-users home
lua-l archive

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


On Sat, Nov 16, 2013 at 8:42 PM, Laurent FAILLIE <l_faillie@yahoo.com> wrote:
> l="Débit ATM              3939 kb/s          945 kb/s"
>     print( l:match('(%d+)(%d+)' ))
> I got only :
>     393    9

Yes, Lua string patterns are not that intelligent!  You need to say
that the two integers are separated by some stuff:

'(%d)%s+kb/s%s+(%d)'

I'm using %s instead of plain ' ' because you might have tabs or some
such there, and doing patterns like this makes them more flexible.