regex 2025.9.1__tar.gz → 2025.10.22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of regex might be problematic. Click here for more details.

Files changed (24) hide show
  1. {regex-2025.9.1/regex.egg-info → regex-2025.10.22}/PKG-INFO +2 -2
  2. {regex-2025.9.1 → regex-2025.10.22}/README.rst +1 -1
  3. {regex-2025.9.1 → regex-2025.10.22}/docs/Features.html +1 -1
  4. {regex-2025.9.1 → regex-2025.10.22}/pyproject.toml +4 -4
  5. regex-2025.10.22/regex/__init__.py +3 -0
  6. regex-2025.9.1/regex_3/regex.py → regex-2025.10.22/regex/_main.py +4 -4
  7. {regex-2025.9.1/regex_3 → regex-2025.10.22/regex}/_regex_core.py +40 -5
  8. {regex-2025.9.1/regex_3 → regex-2025.10.22/regex/tests}/test_regex.py +1 -1
  9. {regex-2025.9.1 → regex-2025.10.22/regex.egg-info}/PKG-INFO +2 -2
  10. regex-2025.10.22/regex.egg-info/SOURCES.txt +18 -0
  11. {regex-2025.9.1/regex_3 → regex-2025.10.22/src}/_regex.c +6 -6
  12. {regex-2025.9.1/regex_3 → regex-2025.10.22/src}/_regex.h +0 -2
  13. {regex-2025.9.1/regex_3 → regex-2025.10.22/src}/_regex_unicode.c +5745 -5558
  14. {regex-2025.9.1/regex_3 → regex-2025.10.22/src}/_regex_unicode.h +30 -27
  15. {regex-2025.9.1 → regex-2025.10.22}/tools/build_regex_unicode.py +20 -30
  16. regex-2025.9.1/MANIFEST.in +0 -7
  17. regex-2025.9.1/regex.egg-info/SOURCES.txt +0 -20
  18. regex-2025.9.1/regex_3/__init__.py +0 -3
  19. regex-2025.9.1/setup.py +0 -9
  20. {regex-2025.9.1 → regex-2025.10.22}/LICENSE.txt +0 -0
  21. {regex-2025.9.1 → regex-2025.10.22}/docs/UnicodeProperties.rst +0 -0
  22. {regex-2025.9.1 → regex-2025.10.22}/regex.egg-info/dependency_links.txt +0 -0
  23. {regex-2025.9.1 → regex-2025.10.22}/regex.egg-info/top_level.txt +0 -0
  24. {regex-2025.9.1 → regex-2025.10.22}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: regex
3
- Version: 2025.9.1
3
+ Version: 2025.10.22
4
4
  Summary: Alternative regular expression module, to replace re.
5
5
  Author-email: Matthew Barnett <regex@mrabarnett.plus.com>
6
6
  License-Expression: Apache-2.0 AND CNRI-Python
@@ -46,7 +46,7 @@ The regex module releases the GIL during matching on instances of the built-in (
46
46
  Unicode
47
47
  -------
48
48
 
49
- This module supports Unicode 16.0.0. Full Unicode case-folding is supported.
49
+ This module supports Unicode 17.0.0. Full Unicode case-folding is supported.
50
50
 
51
51
  Flags
52
52
  -----
@@ -21,7 +21,7 @@ The regex module releases the GIL during matching on instances of the built-in (
21
21
  Unicode
22
22
  -------
23
23
 
24
- This module supports Unicode 16.0.0. Full Unicode case-folding is supported.
24
+ This module supports Unicode 17.0.0. Full Unicode case-folding is supported.
25
25
 
26
26
  Flags
27
27
  -----
@@ -382,7 +382,7 @@ ul.auto-toc {
382
382
  </div>
383
383
  <div class="section" id="unicode">
384
384
  <h1>Unicode</h1>
385
- <p>This module supports Unicode 16.0.0. Full Unicode case-folding is supported.</p>
385
+ <p>This module supports Unicode 17.0.0. Full Unicode case-folding is supported.</p>
386
386
  </div>
387
387
  <div class="section" id="flags">
388
388
  <h1>Flags</h1>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "regex"
7
- version = "2025.9.1"
7
+ version = "2025.10.22"
8
8
  description = "Alternative regular expression module, to replace re."
9
9
  readme = "README.rst"
10
10
  authors = [
@@ -35,10 +35,10 @@ requires-python = ">= 3.9"
35
35
  Homepage = "https://github.com/mrabarnett/mrab-regex"
36
36
 
37
37
  [tool.setuptools]
38
- package-dir = {regex = "regex_3"}
38
+ package-dir = {"regex" = "regex"}
39
39
  py-modules = [
40
40
  "regex.__init__",
41
- "regex.regex",
41
+ "regex._main",
42
42
  "regex._regex_core",
43
- "regex.test_regex",
43
+ "regex.tests.test_regex",
44
44
  ]
@@ -0,0 +1,3 @@
1
+ import regex._main
2
+ from regex._main import *
3
+ __all__ = regex._main.__all__
@@ -241,7 +241,7 @@ __all__ = ["cache_all", "compile", "DEFAULT_VERSION", "escape", "findall",
241
241
  "VERSION1", "X", "VERBOSE", "W", "WORD", "error", "Regex", "__version__",
242
242
  "__doc__", "RegexFlag"]
243
243
 
244
- __version__ = "2.5.161"
244
+ __version__ = "2025.10.22"
245
245
 
246
246
  # --------------------------------------------------------------------
247
247
  # Public interface.
@@ -414,8 +414,8 @@ def escape(pattern, special_only=True, literal_spaces=False):
414
414
  # --------------------------------------------------------------------
415
415
  # Internals.
416
416
 
417
- import regex._regex_core as _regex_core
418
- import regex._regex as _regex
417
+ from regex import _regex_core
418
+ from regex import _regex
419
419
  from threading import RLock as _RLock
420
420
  from locale import getpreferredencoding as _getpreferredencoding
421
421
  from regex._regex_core import *
@@ -429,7 +429,7 @@ from regex._regex_core import (ALNUM as _ALNUM, Info as _Info, OP as _OP, Source
429
429
  # Version 0 is the old behaviour, compatible with the original 're' module.
430
430
  # Version 1 is the new behaviour, which differs slightly.
431
431
 
432
- DEFAULT_VERSION = VERSION0
432
+ DEFAULT_VERSION = RegexFlag.VERSION0
433
433
 
434
434
  _METACHARS = frozenset("()[]{}?*+|^$\\.-#&~")
435
435
 
@@ -18,7 +18,7 @@ import string
18
18
  import unicodedata
19
19
  from collections import defaultdict
20
20
 
21
- import regex._regex as _regex
21
+ from regex import _regex
22
22
 
23
23
  __all__ = ["A", "ASCII", "B", "BESTMATCH", "D", "DEBUG", "E", "ENHANCEMATCH",
24
24
  "F", "FULLCASE", "I", "IGNORECASE", "L", "LOCALE", "M", "MULTILINE", "P",
@@ -121,7 +121,42 @@ class RegexFlag(enum.IntFlag):
121
121
 
122
122
  __str__ = object.__str__
123
123
 
124
- globals().update(RegexFlag.__members__)
124
+ # Put the flags into the module namespace. Being explicit here helps tools like
125
+ # linters and IDEs understand the code better.
126
+ ASCII = RegexFlag.ASCII
127
+ BESTMATCH = RegexFlag.BESTMATCH
128
+ DEBUG = RegexFlag.DEBUG
129
+ DOTALL = RegexFlag.DOTALL
130
+ ENHANCEMATCH = RegexFlag.ENHANCEMATCH
131
+ FULLCASE = RegexFlag.FULLCASE
132
+ IGNORECASE = RegexFlag.IGNORECASE
133
+ LOCALE = RegexFlag.LOCALE
134
+ MULTILINE = RegexFlag.MULTILINE
135
+ POSIX = RegexFlag.POSIX
136
+ REVERSE = RegexFlag.REVERSE
137
+ TEMPLATE = RegexFlag.TEMPLATE
138
+ UNICODE = RegexFlag.UNICODE
139
+ VERBOSE = RegexFlag.VERBOSE
140
+ VERSION0 = RegexFlag.VERSION0
141
+ VERSION1 = RegexFlag.VERSION1
142
+ WORD = RegexFlag.WORD
143
+ A = RegexFlag.A
144
+ B = RegexFlag.B
145
+ D = RegexFlag.D
146
+ E = RegexFlag.E
147
+ F = RegexFlag.F
148
+ I = RegexFlag.I
149
+ L = RegexFlag.L
150
+ M = RegexFlag.M
151
+ P = RegexFlag.P
152
+ R = RegexFlag.R
153
+ S = RegexFlag.S
154
+ U = RegexFlag.U
155
+ V0 = RegexFlag.V0
156
+ V1 = RegexFlag.V1
157
+ W = RegexFlag.W
158
+ X = RegexFlag.X
159
+ T = RegexFlag.T
125
160
 
126
161
  DEFAULT_VERSION = VERSION1
127
162
 
@@ -2488,7 +2523,7 @@ class CallGroup(RegexBase):
2488
2523
  self._key = self.__class__, self.group
2489
2524
 
2490
2525
  def remove_captures(self):
2491
- raise error("group reference not allowed", pattern, self.position)
2526
+ raise error("group reference not allowed", self.pattern, self.position)
2492
2527
 
2493
2528
  def _compile(self, reverse, fuzzy):
2494
2529
  return [(OP.GROUP_CALL, self.call_ref)]
@@ -3058,7 +3093,7 @@ class Group(RegexBase):
3058
3093
  def dump(self, indent, reverse):
3059
3094
  group = self.group
3060
3095
  if group < 0:
3061
- group = private_groups[group]
3096
+ group = self.info.private_groups[group]
3062
3097
  print("{}GROUP {}".format(INDENT * indent, group))
3063
3098
  self.subpattern.dump(indent + 1, reverse)
3064
3099
 
@@ -3413,7 +3448,7 @@ class RefGroup(RegexBase):
3413
3448
  self._key = self.__class__, self.group, self.case_flags
3414
3449
 
3415
3450
  def remove_captures(self):
3416
- raise error("group reference not allowed", pattern, self.position)
3451
+ raise error("group reference not allowed", self.pattern, self.position)
3417
3452
 
3418
3453
  def _compile(self, reverse, fuzzy):
3419
3454
  flags = 0
@@ -883,7 +883,7 @@ class RegexTests(unittest.TestCase):
883
883
  def test_empty_array(self):
884
884
  # SF buf 1647541.
885
885
  import array
886
- for typecode in 'bBuhHiIlLfd':
886
+ for typecode in 'bBhHiIlLfd':
887
887
  a = array.array(typecode)
888
888
  self.assertEqual(regex.compile(b"bla").match(a), None)
889
889
  self.assertEqual(regex.compile(b"").match(a)[1 : ], ())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: regex
3
- Version: 2025.9.1
3
+ Version: 2025.10.22
4
4
  Summary: Alternative regular expression module, to replace re.
5
5
  Author-email: Matthew Barnett <regex@mrabarnett.plus.com>
6
6
  License-Expression: Apache-2.0 AND CNRI-Python
@@ -46,7 +46,7 @@ The regex module releases the GIL during matching on instances of the built-in (
46
46
  Unicode
47
47
  -------
48
48
 
49
- This module supports Unicode 16.0.0. Full Unicode case-folding is supported.
49
+ This module supports Unicode 17.0.0. Full Unicode case-folding is supported.
50
50
 
51
51
  Flags
52
52
  -----
@@ -0,0 +1,18 @@
1
+ LICENSE.txt
2
+ README.rst
3
+ pyproject.toml
4
+ docs/Features.html
5
+ docs/UnicodeProperties.rst
6
+ regex/__init__.py
7
+ regex/_main.py
8
+ regex/_regex_core.py
9
+ regex.egg-info/PKG-INFO
10
+ regex.egg-info/SOURCES.txt
11
+ regex.egg-info/dependency_links.txt
12
+ regex.egg-info/top_level.txt
13
+ regex/tests/test_regex.py
14
+ src/_regex.c
15
+ src/_regex.h
16
+ src/_regex_unicode.c
17
+ src/_regex_unicode.h
18
+ tools/build_regex_unicode.py
@@ -826,15 +826,11 @@ Py_LOCAL_INLINE(BOOL) ascii_has_property(RE_CODE property, Py_UCS4 ch) {
826
826
 
827
827
  /* Checks whether a character has a property, ignoring case. */
828
828
  Py_LOCAL_INLINE(BOOL) ascii_has_property_ign(RE_CODE property, Py_UCS4 ch) {
829
- RE_UINT32 prop;
830
-
831
829
  if (ch > RE_ASCII_MAX) {
832
830
  /* Treat it as an unassigned codepoint. */
833
831
  ch = UNASSIGNED_CODEPOINT;
834
832
  }
835
833
 
836
- prop = property >> 16;
837
-
838
834
  /* The property is case-insensitive. */
839
835
  return ascii_has_property(property, ch);
840
836
  }
@@ -19795,7 +19791,7 @@ static PyObject* match_expand(MatchObject* self, PyObject* str_template) {
19795
19791
  }
19796
19792
 
19797
19793
  /* Hand the template to the template compiler. */
19798
- replacement = call("regex.regex", "_compile_replacement_helper",
19794
+ replacement = call("regex._main", "_compile_replacement_helper",
19799
19795
  PyTuple_Pack(2, self->pattern, str_template));
19800
19796
  if (!replacement)
19801
19797
  return NULL;
@@ -21667,7 +21663,7 @@ Py_LOCAL_INLINE(PyObject*) pattern_subx(PatternObject* self, PyObject*
21667
21663
  /* It isn't a literal, so hand it over to the template compiler. */
21668
21664
  is_template = TRUE;
21669
21665
 
21670
- replacement = call("regex.regex", "_compile_replacement_helper",
21666
+ replacement = call("regex._main", "_compile_replacement_helper",
21671
21667
  PyTuple_Pack(2, self, str_template));
21672
21668
  if (!replacement) {
21673
21669
  release_buffer(&str_info);
@@ -26405,6 +26401,10 @@ PyMODINIT_FUNC PyInit__regex(void) {
26405
26401
  if (!m)
26406
26402
  return NULL;
26407
26403
 
26404
+ #if defined(Py_GIL_DISABLED)
26405
+ PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
26406
+ #endif
26407
+
26408
26408
  d = PyModule_GetDict(m);
26409
26409
 
26410
26410
  x = PyLong_FromLong(RE_MAGIC);
@@ -11,8 +11,6 @@
11
11
  * 2010-01-16 mrab Re-written
12
12
  */
13
13
 
14
- /* Supports Unicode version 12.1.0. */
15
-
16
14
  #define RE_MAGIC 20100116
17
15
 
18
16
  #include "_regex_unicode.h"