| 2682 | self.assertEqual(re.search(r'12(?!)|3', '123')[0], '3') |
| 2683 | |
| 2684 | def test_character_set_any(self): |
| 2685 | # The union of complementary character sets matches any character |
| 2686 | # and is equivalent to "(?s:.)". |
| 2687 | s = '1x\n' |
| 2688 | for p in r'[\s\S]', r'[\d\D]', r'[\w\W]', r'[\S\s]', r'\s|\S': |
| 2689 | with self.subTest(pattern=p): |
| 2690 | self.assertEqual(re.findall(p, s), list(s)) |
| 2691 | self.assertEqual(re.fullmatch('(?:' + p + ')+', s).group(), s) |
| 2692 | |
| 2693 | def test_character_set_none(self): |
| 2694 | # Negation of the union of complementary character sets does not match |