# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"\b([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9][A-Za-z]?))))\s?[0-9][A-Za-z]{2})\b"
test_str = ("AB11AB c25d4f64-2336-4a5d-b94c-14dc12xxxa58 Destroy the blinds run around the house at 4 in the morning yet check cat door for ambush 10 times before coming in but lick yarn hanging out of own butt and being gorgeous with belly side up, chew foot. Loved it, hated it, loved it, hated it scratch my tummy actually i hate you now fight me so poop in the plant pot immediately regret falling into AB11AB c25d4f64-2336-4a5d-b94c-14dc12xxxa58 bathtub and being gorgeous with belly side up for sleep in the bathroom sink but roll over and sun my belly. Eat a plant, kill a hand. Soft kitty warm kitty little ball of furr cry louder at reflection yet hiding behind the couch until lured out by a feathery toy spit up on light gray carpet instead of adjacent linoleum. Fight an alligator and win ooh, are those your $250 dollar sandals? lemme use that as my litter box shred all toilet paper and spread around the house. Cough hairball, eat toilet paper throw down all the stuff in the kitchen crash against wall but walk away like nothing happened yet scratch the box, or hell is other people inspect anything brought into the house, for use lap as chair. Cats are fats i like to pets them they like to meow back. Cough demand to have some AB11AB of whatever the human is cooking, then sniff the offering and walk away. Knock over christmas tree paw at beetle and eat it before it gets away spend all night ensuring people don't sleep sleep all day but stare at wall turn and meow stare at wall some more meow again continue staring chew the plant for catch mouse and gave it as a present or attack dog, run away and pretend to be victim. I bet my nine lives on you-oooo-ooo-hooo throwup on your pillow. c25d4f64-2336-4a5d-b94c-14dc12xxxa58 AB11AB \n\n")
matches = re.finditer(regex, test_str, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html