Added proper handling of metacharacters and escape sequences in character classes (closes #1).