|
Am 21.05.2013 12:48 schröbte S. Fisher:
function escape( s ) return string.gsub(s, "[][^$()%.*+-?]", "%%%0" ) end
Try: > =escape( "12345;:/<>%" ) %1%2%3%4%5%;%:%/%<%>% 10which is probably not what you wanted. So you need to put a few more escapes in there (at least before `%`, `.`, and `-`) ...
Philippp.s.: Maybe we should have a string.escape() function in Lua's standard library (or at least an example in the ref manual ready for copy & paste) ...