You are viewing a single comment's thread. Return to all comments →
Requires Python 3.11 or a newer version due to the use of possessive quantifiers:
import re import sys def extract_urls_names(text: str) -> str: pattern = r'<a href="([^"]*+)"[^>]*+>(?:<[^>]++>)*+\s*+([^<]*+)' matches = re.findall(pattern, text) return "\n".join(f"{url},{name}" for url, name in matches) print(extract_urls_names(sys.stdin.read()), file=sys.stdout)
Seems like cookies are disabled on this browser, please enable them to open this website
Detect HTML links
You are viewing a single comment's thread. Return to all comments →
Requires Python 3.11 or a newer version due to the use of possessive quantifiers: