import re def parse(text): xmr_regex = r'\b4[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{94}\b|\b8[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{94}\b' matches = [] for match in re.finditer(xmr_regex, text): match_text = match.group() start_pos, end_pos = match.span() matches.append((match_text, start_pos, end_pos)) return matches