[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: no substring match?
- From: Alexander Gladysh <agladysh@...>
- Date: Thu, 3 May 2012 07:54:39 +0400
On Thu, May 3, 2012 at 2:46 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> Lua appears to have no literal substring match (find, match, and gmatch all
>> take patterns), and also no function for quoting a string into a pattern
>> that will match that precise string. So there seems to be no way (short of
>> implementing your own pattern quoting) to do a literal substring match in
>> Lua. Am I missing something?
>
> Your "own pattern quoting" is one line in Lua; see PiL2, page 191. See
> also the documentation for string.find (in the manual).
... Or see this for a ready-made implementation:
https://github.com/lua-nucleo/lua-nucleo/blob/master/lua-nucleo/string.lua#L180-202
Alexander.