Optimize character predicates as much as possible, use same logic for anyOf and noneOf.