equal
deleted
inserted
replaced
671 only flags from the re module that are re2-compatible are |
671 only flags from the re module that are re2-compatible are |
672 IGNORECASE and MULTILINE.''' |
672 IGNORECASE and MULTILINE.''' |
673 global _re2 |
673 global _re2 |
674 if _re2 is None: |
674 if _re2 is None: |
675 try: |
675 try: |
676 re2.compile |
676 # check if match works, see issue3964 |
677 _re2 = True |
677 _re2 = bool(re2.match(r'\[([^\[]+)\]', '[ui]')) |
678 except ImportError: |
678 except ImportError: |
679 _re2 = False |
679 _re2 = False |
680 if _re2 and (flags & ~(re.IGNORECASE | re.MULTILINE)) == 0: |
680 if _re2 and (flags & ~(re.IGNORECASE | re.MULTILINE)) == 0: |
681 if flags & re.IGNORECASE: |
681 if flags & re.IGNORECASE: |
682 pat = '(?i)' + pat |
682 pat = '(?i)' + pat |