From 0878f8f4ca3098dfe974e8b8e092923361c5cfaf Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Sat, 22 Nov 2014 09:22:43 +0000 Subject: [PATCH] fix bug in regex for parsing comment telemetry --- aprs.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aprs.py b/aprs.py index 68a83a2..e418eca 100644 --- a/aprs.py +++ b/aprs.py @@ -756,9 +756,9 @@ def parse(raw_sentence): parsed.update({ 'altitude': int(altitude)*0.3048 }) # try parse comment telemetry - match = re.findall(r"^(.*?)\|(([!-{]{2}){2,7})\|(.*)$", extra) - if match: - extra,telemetry,junk,post = match[0] + match = re.findall(r"^(.*?)\|([!-{]{2,14})\|(.*)$", extra) + if match and len(match[0][2]) % 2 == 0: + extra,telemetry,post = match[0] extra += post temp = [] @@ -767,6 +767,7 @@ def parse(raw_sentence): try: temp[i] = base91(telemetry[i*2:i*2+2]) + temp[i] = int(temp[i]) if temp[i].is_integer() else temp[i] except: continue