import re


def extract_links(page):
    """
    >>> sample = ' of <a href="/wiki/Inference" title="Inference">inference</a>, including <a href="/wiki/Fallacies" class="mw-redirect" title="Fallacies">fallacies</a>, and the study of <a href="/wiki/Semantics" title="Semantics">semantics</a>, including <a href="/wiki/Paradox" title="Paradox">paradoxes</a>. Historically, logic has been studied in <a href="/wiki/Philosophy" title="Philosophy">philosophy</a> (since ancient times) and <a href="/wiki/Mathematics" title="Mathematics">mathematics</a> (since the mid-19th century), and recently logic has been studied in <a href="/wiki/Computer_science" title="Computer science">computer science</a>, <a href="/wiki/Linguistics" title="Linguistics">linguistics</a>, <a href="/wiki/Psychology" title="Psychology">psychology</a>, and other fields.</p>'
    >>> links = extract_links(sample)
    >>> len(links)
    9
    >>> links[0] == {'text': 'inference', 'title': 'Inference', 'url': 'http://en.wikipedia.org/wiki/Inference'}
    True
    >>> links[1] == {'text': 'fallacies', 'title': 'Fallacies', 'url': 'http://en.wikipedia.org/wiki/Fallacies'}
    True
    >>> links[2] == {'text': 'semantics', 'title': 'Semantics', 'url': 'http://en.wikipedia.org/wiki/Semantics'}
    True
    >>> links[3] == {'text': 'paradoxes', 'title': 'Paradox', 'url': 'http://en.wikipedia.org/wiki/Paradox'}
    True
    >>> links[4] == {'text': 'philosophy', 'title': 'Philosophy', 'url': 'http://en.wikipedia.org/wiki/Philosophy'}
    True
    >>> links[5] == {'text': 'mathematics', 'title': 'Mathematics', 'url': 'http://en.wikipedia.org/wiki/Mathematics'}
    True
    >>> links[6] == {'text': 'computer science', 'title': 'Computer science', 'url': 'http://en.wikipedia.org/wiki/Computer_science'}
    True
    >>> links[7] == {'text': 'linguistics', 'title': 'Linguistics', 'url': 'http://en.wikipedia.org/wiki/Linguistics'}
    True
    >>> links[8] == {'text': 'psychology', 'title': 'Psychology', 'url': 'http://en.wikipedia.org/wiki/Psychology'}
    True
    """

    links = []
    for m in re.finditer(r'<a href="/wiki/(.*?)".*?title="(.*?)".*?>(.*?)</a>', page):
        a, b, c = m.groups()
        if ":" not in a:
            links.append(
                {"url": "http://en.wikipedia.org/wiki/" + a, "title": b, "text": c}
            )
    return links