Detect HTML links

  • + 1 comment

    So my code works for all test cases except test case 5, where the answers are the same but still not accepted

    import re
    html_lines = [input() for _ in range(int(input()))]
    pattern = re.compile(r"<a\shref=\"(.+?)\".*?(?<=>)([^><]*?)(?=<\/)")
    for i in html_lines:
        if pattern.search(i):
            for item in list(pattern.findall(i)):
                print(*item, sep=",")