[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua match regex
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 14 Nov 2008 09:53:17 -0200
> I am struggling with trying to match regex agains string. Let's say I have
> a reg that looks like 4|44|22|445, basically a bunch of arbitrary numbers.
> Is that any Lua function that can tell me if a string match exactly one of
> those numbers?
If you know that your string contains a number, try this:
function test(item,list) print(not not string.find(list,"|"..item.."|")) end
list="|4|44|22|445|"
item="22"
test(item,list)
item="29"
test(item,list)