From 841df1e5a591461723ca6c73c01f73c986e8d6b8 Mon Sep 17 00:00:00 2001 From: tamihiro Date: Thu, 4 Apr 2019 12:33:15 +0900 Subject: [PATCH] Hyperlink ASN only when square-bracketed --- lg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lg.py b/lg.py index 6a9f4e7..89875bc 100644 --- a/lg.py +++ b/lg.py @@ -76,7 +76,7 @@ def add_links(text): ret_text.append(re.sub(r'(\d+)', r'\1', line)) else: line = re.sub(r'([a-zA-Z0-9\-]*\.([a-zA-Z]{2,3}){1,2})(\s|$)', r'\1\3', line) - line = re.sub(r'AS(\d+)', r'AS\1', line) + line = re.sub(r'(?<=\[)AS(\d+)', r'AS\1', line) line = re.sub(r'(\d+\.\d+\.\d+\.\d+)', r'\1', line) if len(request.path) >= 2: hosts = "/".join(request.path.split("/")[2:])