diff --git a/lg.py b/lg.py
index 7be6010..9cbde28 100644
--- a/lg.py
+++ b/lg.py
@@ -79,7 +79,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:])