[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: how to implement group while match string?
- From: Shmuel Zeigerman <shmuz@...>
- Date: Tue, 30 Jan 2007 20:46:17 +0200
Samuel Chi wrote:
just like '*(?P<name>...)*' in python.
for example, i want to extract 1,10,'int', 'id' from '1-10:int=id'.
how to do?
Due to multiple return feature of Lua functions,
it can be done yet simpler than in Python, for example:
n1,n2,w1,w2 = string.match ('1-10:int=id', '(%d+)%p(%d+)%p(%w+)%p(%w+)')
(Of course, you can use more meaningful names than n1,w1,...)
--
Shmuel