[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string.find does act differently based on input?
- From: liam mail <liam.list@...>
- Date: Sat, 7 Jul 2012 18:30:58 +0100
On 7 July 2012 18:14, <meino.cramer@gmx.de> wrote:
> steve donovan <steve.j.donovan@gmail.com> [12-07-07 19:04]:
>> On Sat, Jul 7, 2012 at 6:51 PM, <meino.cramer@gmx.de> wrote:
>> > Why does string.find find the word "test" but not the "(" ?
>>
>> Because '(' is a 'magic character' in string patterns. If you say
>> string.find(s,'(',1,true) then it does a plain search.
>>
>> steve d.
>>
>
> Thanks to all for the answers! :) This list is as fast and
> user friendly as Lua itsself :))))
>
> If "(" is magic...
>
> Is it possible to find the string, which is enclosed in "()"...for
> example
>
> a="indentifier(StringOfUnknownLength)"
> =string.find(a, <insert magic here> )
> 13 33
>
>
> ???
>
> Best regards,
> mcc
>
>
>
>
Yes the magic is "%b() to find the start and end which are balanced.
Liam