>>> re.compile('(?P=)') = bad character in backref group name '' at position 4 + bad character in group name '' at position 4 >>> re.compile('foo[a-') = unexpected end of regular expression at position 6 + bad character range a- at position 4 >>> re.compile('[') = unexpected end of regular expression at position 1 + unterminated character set at position 0 >>> re.compile('[^') = unexpected end of regular expression at position 2 + unterminated character set at position 0 >>> re.compile('[a') = unexpected end of regular expression at position 2 + unterminated character set at position 0 >>> re.compile('[a-') = unexpected end of regular expression at position 3 + bad character range a- at position 1 >>> re.compile('[\\w-b]') = bad character range at position 4 + bad character range \w-b at position 1 >>> re.compile('[a-\\w]') = bad character range at position 3 + bad character range a-\w at position 1 >>> re.compile('[b-a]') = bad character range at position 3 + bad character range b-a at position 1 >>> re.compile('(') = unbalanced parenthesis at position 1 + missing ), unterminated subpattern at position 0 >>> re.compile('((a|b)') = unbalanced parenthesis at position 6 + missing ), unterminated subpattern at position 0 >>> re.compile('(?z)') = unexpected end of pattern at position 3 + unknown extension ?z at position 1 >>> re.compile('(?iz)') = unknown extension at position 3 + unknown flag at position 3 >>> re.compile('(?i') = unexpected end of pattern at position 3 + missing ) at position 3 >>> re.compile('(?#abc') = unbalanced parenthesis at position 6 + missing ), unterminated comment at position 0 >>> re.compile('(?<') = syntax error at position 3 + unexpected end of pattern at position 3 >>> re.compile('(?<>)') = syntax error at position 4 + unknown extension ?<> at position 1 >>> re.compile('\\') = bogus escape (end of line) at position 0 + bad escape (end of pattern) at position 0 >>> re.compile('(abc\\1)') = cannot refer to open group at position 4 + cannot refer to an open group at position 4 >>> re.compile('()(?(1)a|b') = unbalanced parenthesis at position 10 + missing ), unterminated subpattern at position 2 >>> re.sub('()', '\\g<268435455>', 'xx') - the group number is too large at position 3 + invalid group reference at position 3 >>> re.compile('(?P)(?(268435455))') = the group number is too large at position 10 + invalid group reference at position 10 >>> re.compile(b'[\\567]') = octal escape value '\\567' outside of range 0-0o377 at position 1 + octal escape value \567 outside of range 0-0o377 at position 1 >>> re.compile(b'[\\911]') = bogus escape: '\\9' at position 1 + bad escape \9 at position 1 >>> re.compile(b'[\\x1z]') = bogus escape: '\\x1' at position 1 + bad escape \x1 at position 1 >>> re.compile(b'\\567') = octal escape value '\\567' outside of range 0-0o377 at position 0 + octal escape value \567 outside of range 0-0o377 at position 0 >>> re.compile(b'\\911') = bogus escape: '\\91' at position 0 + invalid group reference at position 0 >>> re.compile(b'\\x1') = bogus escape: '\\x1' at position 0 + bad escape \x1 at position 0 >>> re.compile(b'\\x1z') = bogus escape: '\\x1' at position 0 + bad escape \x1 at position 0 >>> re.compile('[\\567]') = octal escape value '\\567' outside of range 0-0o377 at position 1 + octal escape value \567 outside of range 0-0o377 at position 1 >>> re.compile('[\\911]') = bogus escape: '\\9' at position 1 + bad escape \9 at position 1 >>> re.compile('[\\x1z]') = bogus escape: '\\x1' at position 1 + bad escape \x1 at position 1 >>> re.compile('[\\u123z]') = bogus escape: '\\u123' at position 1 + bad escape \u123 at position 1 >>> re.compile('[\\U0001234z]') = bogus escape: '\\U0001234' at position 1 + bad escape \U0001234 at position 1 >>> re.compile('[\\U00110000]') = bogus escape: '\\U00110000' at position 1 + bad escape \U00110000 at position 1 >>> re.compile('\\567') = octal escape value '\\567' outside of range 0-0o377 at position 0 + octal escape value \567 outside of range 0-0o377 at position 0 >>> re.compile('\\911') = bogus escape: '\\91' at position 0 + invalid group reference at position 0 >>> re.compile('\\x1') = bogus escape: '\\x1' at position 0 + bad escape \x1 at position 0 >>> re.compile('\\x1z') = bogus escape: '\\x1' at position 0 + bad escape \x1 at position 0 >>> re.compile('\\u123') = bogus escape: '\\u123' at position 0 + bad escape \u123 at position 0 >>> re.compile('\\u123z') = bogus escape: '\\u123' at position 0 + bad escape \u123 at position 0 >>> re.compile('\\U0001234') = bogus escape: '\\U0001234' at position 0 + bad escape \U0001234 at position 0 >>> re.compile('\\U0001234z') = bogus escape: '\\U0001234' at position 0 + bad escape \U0001234 at position 0 >>> re.compile('\\U00110000') = bogus escape: '\\U00110000' at position 0 + bad escape \U00110000 at position 0 >>> re.sub('x', '\\400', 'x') - octal escape value '\\400' outside of range 0-0o377 at position 0 + octal escape value \400 outside of range 0-0o377 at position 0 >>> re.sub('x', '\\777', 'x') - octal escape value '\\777' outside of range 0-0o377 at position 0 + octal escape value \777 outside of range 0-0o377 at position 0 >>> re.compile('(?Pxy)') = unknown specifier: ?Px at position 3 + unknown extension ?Px >>> re.compile('(?P)(?P=a') = unterminated name at position 12 + missing ), unterminated name at position 11 >>> re.compile('(?P=') = unterminated name at position 4 + missing group name at position 4 >>> re.compile('(?P=1)') = bad character in backref group name '1' at position 4 + bad character in group name '1' at position 4 >>> re.compile('(?P=a)') = unknown group name: 'a' at position 4 + unknown group name 'a' >>> re.compile('(?P=a1)') = unknown group name: 'a1' at position 4 + unknown group name 'a1' >>> re.compile('(?P=a.)') = bad character in backref group name 'a.' at position 4 + bad character in group name 'a.' at position 4 >>> re.compile('(?P<)') = unterminated name at position 5 + missing >, unterminated name at position 4 >>> re.compile('(?P, unterminated name at position 4 >>> re.compile('(?P<') = unterminated name at position 4 + missing group name at position 4 >>> re.compile('(?(') = unterminated name at position 3 + missing group name at position 3 >>> re.compile('(?(a))') = unknown group name: 'a' at position 3 + unknown group name 'a' at position 3 >>> re.compile('(?(-1))') = bad character in group name at position 3 + bad character in group name '-1' at position 3 >>> re.compile('(?(1a))') = bad character in group name at position 3 + bad character in group name '1a' at position 3 >>> re.compile('(?(a.))') = bad character in group name at position 3 + bad character in group name 'a.' at position 3 >>> re.sub('(?Px)', '\\g, unterminated name at position 3 >>> re.sub('(?Px)', '\\g<', 'xx') - unterminated name at position 3 + missing group name at position 3 >>> re.sub('(?Px)', '\\g', 'xx') - missing group name at position 1 + missing < at position 2 >>> re.sub('(?Px)', '\\g', 'xx') - bad character in group name at position 3 + bad character in group name 'a a' at position 3 >>> re.sub('(?Px)', '\\g<1a1>', 'xx') - bad character in group name at position 3 + bad character in group name '1a1' at position 3 >>> re.sub('(?Px)', '\\g<-1>', 'xx') - negative group number at position 3 + bad character in group name '-1' at position 3 >>> re.sub('(?Px)', '\\g<©>', 'xx') - bad character in group name at position 3 + bad character in group name '©' at position 3