Originally Posted by Phanx
Oh, oops, I've been writing too much JavaScript at work. Try escaping the characters correctly for Lua.
Code:
text = gsub(text, "[\1\10\32\34#%%'%(%)%*%+,%-%./%d:;<>=%[%]^{|}~]", "")
|
Yeah, I just edited the pattern to this:
Code:
text = text:gsub("[\1\10\32\34%\\#%%%'%(%)%*%+,%-%./%d:;<>=%[%]^{|}~]", space)
... and it seemed to do the trick.
One thing missing in the pattern you supplied, is escaping backslash!
One last thing, omitting single letters. At this point, using these three:
Code:
text = text:gsub("[\1\10\32\34\92#%%%'%(%)%*%+,%-%./%d:;<>=%[%]^{|}~]", space)
text = text:gsub("%s%s+", space)
text = text:gsub("%f[%a%d]%d+%f[%A%D]", "")
... there will be only words left, apart from single letter variables. They are pretty useless in a dictionary.