diff --git a/src/auditwheel/policy/external_references.py b/src/auditwheel/policy/external_references.py
index 1c05b10..23afde8 100644
--- a/src/auditwheel/policy/external_references.py
+++ b/src/auditwheel/policy/external_references.py
@@ -8,7 +8,7 @@ from ..elfutils import filter_undefined_symbols, is_subdir
 from . import load_policies
 
 log = logging.getLogger(__name__)
-LIBPYTHON_RE = re.compile(r"^libpython\d\.\dm?.so(.\d)*$")
+LIBPYTHON_RE = re.compile(r"^libpython\d+\.\d+m?.so(.\d)*$")
 
 
 def lddtree_external_references(lddtree: dict, wheel_path: str) -> dict:

diff --git a/tests/unit/test_policy.py b/tests/unit/test_policy.py
index 9fa21c9..adbdad8 100644
--- a/tests/unit/test_policy.py
+++ b/tests/unit/test_policy.py
@@ -10,6 +10,7 @@ from auditwheel.policy import (
     get_policy_name,
     get_priority_by_name,
     get_replace_platforms,
+    lddtree_external_references,
 )
 
 
@@ -202,3 +203,32 @@ class TestPolicyAccess:
     def test_get_by_name_duplicate(self):
         with pytest.raises(RuntimeError):
             get_priority_by_name("duplicate")
+
+
+class TestLddTreeExternalReferences:
+    """Tests for lddtree_external_references."""
+
+    def test_filter_libs(self):
+        """Test the nested filter_libs function."""
+        filtered_libs = [
+            "ld-linux-x86_64.so.1",
+            "ld64.so.1",
+            "ld64.so.2",
+            "libpython3.7m.so.1.0",
+            "libpython3.9.so.1.0",
+            "libpython3.10.so.1.0",
+            "libpython999.999.so.1.0",
+        ]
+        unfiltered_libs = ["libfoo.so.1.0", "libbar.so.999.999.999"]
+        libs = filtered_libs + unfiltered_libs
+
+        lddtree = {
+            "realpath": "/path/to/lib",
+            "needed": libs,
+            "libs": {lib: {"needed": [], "realpath": "/path/to/lib"} for lib in libs},
+        }
+        full_external_refs = lddtree_external_references(lddtree, "/path/to/wheel")
+
+        # Assert that each policy only has the unfiltered libs.
+        for policy in full_external_refs:
+            assert set(full_external_refs[policy]["libs"]) == set(unfiltered_libs)

libpython3.x is skipped but libpython3.xx is included
howdy,

i noticed when running auditwheel repair on a wheel with dependency on libpython3.8.so or libpython3.9.so, they are not added to the wheel libs directory, but libpython3.10.so and libpython3.11.so are added. I'm not very familiar with the project, but i suspect [the regex detecting libpython](https://github.com/pypa/auditwheel/blob/63c30761e6857491af50fbb1922ecfd4c034ef76/src/auditwheel/policy/external_references.py#L11) could be the culprit
tests/unit/test_policy.py::TestLddTreeExternalReferences::test_filter_libs
tests/unit/test_policy.py::test_32bits_arch_name[armv6l-armv6l] tests/unit/test_policy.py::test_32bits_arch_name[armv7l-armv7l] tests/unit/test_policy.py::test_32bits_arch_name[armv8l-armv7l] tests/unit/test_policy.py::test_32bits_arch_name[aarch64-armv7l] tests/unit/test_policy.py::test_32bits_arch_name[i686-i686] tests/unit/test_policy.py::test_32bits_arch_name[x86_64-i686] tests/unit/test_policy.py::test_64bits_arch_name[armv8l-aarch64] tests/unit/test_policy.py::test_64bits_arch_name[aarch64-aarch64] tests/unit/test_policy.py::test_64bits_arch_name[ppc64le-ppc64le] tests/unit/test_policy.py::test_64bits_arch_name[i686-x86_64] tests/unit/test_policy.py::test_64bits_arch_name[x86_64-x86_64] tests/unit/test_policy.py::test_replacement_platform[linux_aarch64-expected0] tests/unit/test_policy.py::test_replacement_platform[manylinux1_ppc64le-expected1] tests/unit/test_policy.py::test_replacement_platform[manylinux2014_x86_64-expected2] tests/unit/test_policy.py::test_replacement_platform[manylinux_2_24_x86_64-expected3] tests/unit/test_policy.py::test_pep600_compliance tests/unit/test_policy.py::TestPolicyAccess::test_get_by_priority tests/unit/test_policy.py::TestPolicyAccess::test_get_by_priority_missing tests/unit/test_policy.py::TestPolicyAccess::test_get_by_priority_duplicate tests/unit/test_policy.py::TestPolicyAccess::test_get_by_name tests/unit/test_policy.py::TestPolicyAccess::test_get_by_name_missing tests/unit/test_policy.py::TestPolicyAccess::test_get_by_name_duplicate