Fink links/images or emphasis from text.

    :param text: the original text.
    :param root_node: a reference to the root node of the AST.
    :returns: an iterable of match object.

def find_links_or_emphs(text, root_node):
    """Fink links/images or emphasis from text.

    :param text: the original text.
    :param root_node: a reference to the root node of the AST.
    :returns: an iterable of match object.
    """
    delimiters_re = re.compile(r'(?:!?\[|\*+|_+)')
    i = 0
    delimiters = []
    escape = False
    matches = []
    code_pattern = re.compile(r'(?<!`)(`+)(?!`)([\s\S]+?)(?<!`)\1(?!`)')

    while i < len(text):
        if escape:
            escape = False
            i += 1
        elif text[i] == '\\':
            escape = True
            i += 1
        elif code_pattern.match(text, i):
            i = code_pattern.match(text, i).end()
        elif text[i] == ']':
            node = look_for_image_or_link(text, delimiters, i, root_node, matches)
            if node:
                i = node.end()
                matches.append(node)
            else:
                i += 1
        else:
            m = delimiters_re.match(text, i)
            if m:
                delimiters.append(Delimiter(m, text))
                i = m.end()
            else:
                i += 1
    process_emphasis(text, delimiters, None, matches)
    return matches