[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Finding end of string
- From: "Soni L." <fakedme@...>
- Date: Tue, 10 Oct 2017 15:25:31 -0300
On 2017-10-10 02:44 PM, Dirk Laurie wrote:
2017-10-10 14:52 GMT+02:00 Soni L. <fakedme@gmail.com>:
local m, pos
repeat -- TODO fix
m, pos = string.match(word_eol[2],
"%f[\\"..cw:sub(1,1).."](\\*)"..cw:sub(1,1).."()", pos)
until #m % 2 == 0
I'm having issues making this work.
The title of the post describes a trivial problem (answer: #str+1).
I can't work by reading it what problem the code tries to solve.
Sorry, I meant end of string literal.
After a few hours I came up with this, which works:
local m, pos
repeat
m, pos = string.match(word_eol[2], "(\\*)"..cw:sub(1,1).."()", pos or 2)
until m == nil or #m % 2 == 0
(cw:sub(1,1) being one of " or ')
--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.