lua-users home
lua-l archive

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


Sure but it is available & nicely easy for string.find as of now, so
I'm not suggesting something that would be like a huge addition or out
of the scope what the Lua core does right now.

And all the suggested options for gsub seem not totally foolproof or
not easy (not trivially easy for beginners, and the %p seems to depend
on locale which doesn't sound like a good idea if this is meant to be
secure in all cases - and it's not entirely obvious to beginners
either).


And there is no compelling reason that gsub doesn't have a plain
option, except that it just doesn't have one. find has it, why not
gsub? I bet it wouldn't even take much lines of code to add.

Or just add a basic additional replace function.

Regards,
Jonas Thiem

PS: for the record, I'm not for bloating up Lua infinitely either. In
fact, I'd also support removing patterns entirely and just have a
basic find/replace that works. I find that more essential to have, and
for "proper" regular expressions similar to what perl is capable of,
one would need an additional lib anyway.


On Mon, Aug 25, 2014 at 9:33 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2014-08-25 5:51 GMT+02:00 Jonas Thiem <jonasthiem@googlemail.com>:
>
>> Well, all I would suggest is adding a plain option to gsub. ;-)
>>
>> But this has all derailed so I don't know what this thread is about anymore
>
> Sooner or later, in any thread dealing with the string library,
> someone says "but it's easy in LPeg" and there we go.
>