Repository: asciimoo/exrex (language: python)

Issue:
Import error using Python 3.11.0
I try using this library in Python 3.11.0 and I get an import error:
```
    import exrex
../../../env/lib/python3.11/site-packages/exrex.py:25: in <module>
    from re import sre_parse, U
E   ImportError: cannot import name 'sre_parse' from 're'
```


Discussion / hints:
Does using `re._parser` instead work?
It doesn't work as it is now. https://github.com/python/cpython/issues/91308
@asciimoo are you still maintaining this package? Don't want to nag you, but this issue is also blocking us from upgrading to Python 3.11, so want to know whether we should look for other ways of solving the issue 🙂 

Fix patch:
diff --git a/exrex.py b/exrex.py
index 24c0de9..be74f92 100644
--- a/exrex.py
+++ b/exrex.py
@@ -22,7 +22,11 @@
     from future_builtins import map, range
 except:
     pass
-from re import match, sre_parse, U
+from re import match, U
+try:
+    import re._parser as sre_parse
+except ImportError: # Python < 3.11
+    from re import sre_parse
 from itertools import tee
 from random import choice, randint
 from types import GeneratorType


Test patch:
diff --git a/tests.py b/tests.py
index 8a8a63e..ef0d42c 100644
--- a/tests.py
+++ b/tests.py
@@ -20,8 +20,12 @@
 
 from exrex import generate, count, getone, CATEGORIES, simplify
 import re
-import sre_parse
+try: 
+    import re._parser as sre_parse
+except ImportError: # Python < 3.11
+    from re import sre_parse
 from sys import exit, version_info
+
 IS_PY3 = version_info[0] == 3
 
 RS = {