lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Luiz Henrique de Figueiredo <> wrote:
> >Is there any way for `gsub' to match strings without regard to case?
> Not directly. But you may make do:
>    Change the literal parts of the pattern to be case insensitive:

Thanks.  I came up with:

function gisub(s, pat, repl, n)
    pat = gsub(pat, '(%a)', 
               function (v) return '['..strupper(v)..strlower(v)..']' end)
    if n then
        return gsub(s, pat, repl, n)
        return gsub(s, pat, repl)

This might have been asked before, but why didn't you guys make
`gsub' also accept `nil' for the final parameter?