'Apply the regular expressions to the target_str and return a list
according to the class __init__ documentation.
:param target_str: The target string where the regular expressions are
going to be applied. First we apply the esmre algorithm and then we do
some magic of our own.
See test_re.py for usage examples.'

def query(self, target_str):

    result = []
    if isinstance(target_str, unicode):
        target_str = target_str.encode(DEFAULT_ENCODING)
    for (regex_str, compiled_regex) in self._re_cache.iteritems():
        matchobj = compiled_regex.search(target_str)
        if matchobj:
            resitem = [matchobj, regex_str, compiled_regex]
            if (regex_str in self._assoc_obj):
                resitem.extend(self._assoc_obj[regex_str])
            result.append(resitem)
    return result
