From f897abce1125b46bc84a58fa684e35ce0989f2ea Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 12 Mar 2020 14:02:25 -0700 Subject: [PATCH] Simplify this regex, remove unnecessary capture group. --- voussoirkit/bytestring.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/voussoirkit/bytestring.py b/voussoirkit/bytestring.py index 48116e6..97f69b9 100644 --- a/voussoirkit/bytestring.py +++ b/voussoirkit/bytestring.py @@ -103,12 +103,12 @@ def parsebytes(string): string = string.lower().strip() string = string.replace(' ', '').replace(',', '') - matches = re.findall('((\\.|-|\\d)+)', string) + matches = re.findall(r'[\d\.-]+', string) if len(matches) == 0: raise ValueError('No numbers found') if len(matches) > 1: raise ValueError('Too many numbers found') - byte_value = matches[0][0] + byte_value = matches[0] if not string.startswith(byte_value): raise ValueError('Number is not at start of string')