Fixed IDLE tests after changing re error messages (issue #22578).
Fixed AttributeError when the regular expression starts from illegal escape.