Re: string.find does act differently based on input?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: string.find does act differently based on input?
- From: meino.cramer@... 
- Date: Sat, 7 Jul 2012 18:59:25 +0200
meino.cramer@gmx.de <meino.cramer@gmx.de> [12-07-07 18:56]:
> Hi,
> 
> I did this interactively after I had the same behaviour
> in my script.
> 
> Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> > a="find(test)"
> > =string.find(a,"test")
> 6	9
> > =string.find(a,"(" )
> stdin:1: unfinished capture
> stack traceback:
> [C]: in function 'find'
> stdin:1: in main chunk
> [C]: ?
> > 
> 
> Why does string.find find the word "test" but not the "(" ?
> 
> Best regards,
> mcc
> 
> 
> 
Hi,
well I found the answer myself.
string.find does pattern matching as string,findpattern.
So "(" is special and needs to be escaped with "%". 
After that is works fine.
Best regards,
mcc