[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Case-insensitive gsub?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 19 Apr 2001 22:13:10 -0300 (EST)
>> Change the literal parts of the pattern to be case insensitive:
>
>function gisub(s, pat, repl, n)
> pat = gsub(pat, '(%a)',
> function (v) return '['..strupper(v)..strlower(v)..']' end)
Yes, that's what I meant, but you have to be careful if pat has classes,
such as %a. You might want to first encode all %LETTER by %DECIMAL, do
your conversion above, and then restore %LETTER.
>This might have been asked before, but why didn't you guys make
>`gsub' also accept `nil' for the final parameter?
I don't know :-)
--lhf