dp-zp-agent/tools/evaluation/urls.py

14 lines
338 B
Python

"""Historical evaluation URL comparison, separate from runtime URL security."""
import re
MARKDOWN_URL_RE = re.compile(r"\[[^\]]*\]\((https?://[^)]+)\)")
def normalize_url(value: str) -> str:
value = value.strip()
match = MARKDOWN_URL_RE.search(value)
if match:
value = match.group(1)
return value.rstrip("/")