> Finding longest "=" sequence is arguably simplest and not optimal. I prefer
> finding shortest long closing quote: min(N): ("]" "=" ^ N "]") not in string.
>
> This algorithm have no worst cases.
>
> Sample implementation at
> https://github.com/martin-eden/workshop/blob/master/formats/lua/quote_string/intact.lua#L16
It doesn't seem to work for "]]a]=". (Result is "[=[]]a]=]=]"...)
-- Roberto