From 16174fe4cb3e55e730808c800f86b46c844e1a62 Mon Sep 17 00:00:00 2001 From: Ian Roddis <31021769+iroddis@users.noreply.github.com> Date: Thu, 23 Jul 2026 10:54:10 -0300 Subject: [PATCH] Adjusting regex for ISO and UNC threads to better support floats --- app/services/augmented_part_sync.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/services/augmented_part_sync.py b/app/services/augmented_part_sync.py index c136f66..a1da89a 100644 --- a/app/services/augmented_part_sync.py +++ b/app/services/augmented_part_sync.py @@ -52,8 +52,10 @@ MM_PER_INCH = 25.4 # e.g. # M8-1.25 - 8mm OD, 1.25 mm pitch # M8 x 1.25 +# M50x.75 - No leading digit on floats +# Float pattern: \d*\.?\d+ _ISO_THREAD_RE = re.compile( - r"^M\s*(?P\d+(?:\.\d+)?)\s*[xX-]\s*(?P\d+(?:\.\d+)?)(?P.*)$" + r"^M\s*(?P\d*\.?\d+)\s*[xX-]\s*P?(?P\d*\.?\d+)(?P.*)$" ) # e.g. @@ -63,7 +65,7 @@ _ISO_THREAD_RE = re.compile( # # Leading digit / period, one or more digits, a dash, then _UNC_THREAD_RE = re.compile( - r"^(?P\d+(?:\.\d+)?(?:/\d+)?)\s*-\s*(?P\d+)" + r"^(?P\d*\.?\d+)\s*-\s*(?P\d*\.?\d+)" r"\s*(?PUNEF|UNC|UNF|UNS|UN)?$", re.IGNORECASE, )