Handle [] in glob patterns properly.
Escape more regex control characters.