|
Jan Schütze wrote:
I wanted to ask if there is any way to escape (fast) all magic characters in the string one wants to replace?
I don't know if it's fast enough for you, but this function does what you want: Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
function plain2pat(s)s = string.gsub(s, "[[%%.*+?^$()-]", "%%%0") return (string.gsub(s, "%z", "%%z")) endallchars = "" for i = 0, 255 doallchars = allchars .. string.char(i) endprint(string.find(allchars, plain2pat(allchars)))
1 256 -- Aaron http://arundelo.com _________________________________________________________________Interest Rates Fall Again! $430,000 Mortgage for $1,399/mo - Calculate new payment http://www.lowermybills.com/lre/index.jsp?sourceid=lmb-9632-18679&moid=7581