add support for braces and brackets to valid_string()