Skip to content

Commit

Permalink
even more fixes in the regex
Browse files Browse the repository at this point in the history
  • Loading branch information
eavanvalkenburg committed Apr 13, 2021
1 parent 2119100 commit 02f0d24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/pysiaalarm/utils/regexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
(?:id)?(?:(?<=id)(?P<id>\d*))?\/?
(?:ri)?(?:(?<=ri)(?P<ri>\d*))?\/?
(?P<code>[a-zA-Z]{2})?
(?P<message>[\w\s\^]*)
(?P<message>[ -~][^\[\]]*)?
[\]]
(?:\[(?:(?<=\[)(?P<xdata>[\w\s\^]*)(?=\]))\])?
(?:\[(?:(?<=\[)(?P<xdata>[ -~][^\[\]]*)(?=\]))\])?
[_]?
(?P<timestamp>[0-9:,-]*)?$
"""
Expand Down
13 changes: 12 additions & 1 deletion tests/test_sia_package_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,18 @@ def case_bug(self):
"Closing Report",
"CL",
None,
False
False,
)

def case_bug2(self):
"""Test case from SIA #42."""
return (
r'5670004D"SIA-DCS"8070L0#123456[#123456|Nri0KR1^TAST. 001 ^]_13:49:12,04-13-2021',
"123456",
"Heat Restoral",
"KR",
None,
False,
)

def case_dc04(self):
Expand Down

0 comments on commit 02f0d24

Please sign in to comment.