[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lost (again) with strings patterns
- From: steve donovan <steve.j.donovan@...>
- Date: Sat, 16 Nov 2013 20:51:55 +0200
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.