1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Fix DeprecationWarnings about string escapes in regex

This commit is contained in:
dmiller
2023-02-03 23:12:45 +00:00
parent 2d4e45ead8
commit 4a41125fbc
2 changed files with 6 additions and 6 deletions

View File

@@ -780,11 +780,11 @@ class DateSubcriterion(Subcriterion):
self.fuzzies = argument.count("~")
argument = argument.replace("~", "")
self.minus_notation = False
if re.match("\d\d\d\d-\d\d-\d\d$", argument) is not None:
if re.match(r"\d\d\d\d-\d\d-\d\d$", argument) is not None:
year, month, day = argument.split("-")
self.date = datetime.date(int(year), int(month), int(day))
self.argument = argument
elif re.match("[-|\+]\d+$", argument) is not None:
elif re.match(r"[-|\+]\d+$", argument) is not None:
# Convert the date from the "-n" notation into YYYY-MM-DD
parsed_date = datetime.date.fromordinal(
datetime.date.today().toordinal() + int(argument))