]> git.cworth.org Git - turbot/commitdiff
Use a raw string for a regular expression
authorCarl Worth <cworth@cworth.org>
Tue, 29 Sep 2020 13:20:59 +0000 (06:20 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 29 Sep 2020 13:20:59 +0000 (06:20 -0700)
Previously, the string had an unrecognized escape sequence ('\*').
With a non-raw string we could have doubled the backslash, but it's
much cleaner to just use a raw string instead, (so that backslashes
are used for regular-expression escaping, and not also for string
escaping).

turbot.py

index e125e0d2efd17c837123fad381e6fa0bd0a6e5fb..7371dc2ace556b8f5d1a361074096c9685d4ceca 100755 (executable)
--- a/turbot.py
+++ b/turbot.py
@@ -64,7 +64,7 @@ def rot():
     if not signature_verifier.is_valid_request(data, headers):
         return make_response("invalid request", 403)
 
-    match = re.match('^([0-9]+|\*) (.*)$', query)
+    match = re.match(r'^([0-9]+|\*) (.*)$', query)
     if (match):
         try:
             count = int(match.group(1))