string.JavascriptSafe improvements

Now less intensive on the GC, uses a nicer method of char replacement
added string.PatternSafe

Escapes a string for safe use in a Lua pattern.
make things use string.PatternSafe

Also fixes the spawn menu search box taking patterns and causing errors.
Merge pull request #785 from wiox/strings

Pattern (and JavaScript) escaping betterness