lua-users home
lua-l archive

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


So what about getting this into the reference manual?

I think the reference manual should contain the necessary explanation
how to do a replace without pattern processing. I checked on PiL for a
lot of things and it has a couple of neat tricks, but this isn't
something that I should need to check a hint book for (IMHO)

A simple short side note which tells the reader about ^%W for safely
escaping all patterns in the section on the standard lib/string.gsub
would be sufficient.

Regards,
Jonas Thiem

On 08/25/2014 07:10 PM, Roberto Ierusalimschy wrote:
>> 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).
> 
> Forget %p, if you cannot understand locales. Use ^%W, as several others
> already mentioned in this thread, and as PiL recommends. (BTW, a good
> book, for beginners too ;)
> 
> -- Roberto
>