|
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 ')
Should not the answer rather be 11?
And would not
function end_of_string_literal(word,quote)
local pattern = '()%b' .. quote:rep(2) ..'()'
return select(2,word:match(pattern))
end
be somewhat simpler?
It says "end". It implies you already know the start.
"\""