# Packet () Print (the re.findall ( " (AD) / (VV) " , " adddad / vvdddddddddd " )) Print (the re.findall ( " (AD) / (D) " , " AD / DDAD / vvdddddddddd " )) Print (the re.findall ( " (A) (D) " , " adddad / vvdddddddddd " )) # intermediate packets have letters and special symbols spaced Print (the re.findall ( " (AD) / D (DA ) " , " AD / DDAD / vvdddddddddd ")) print(re.search("(a)g(b)","adagbgdagbhagb").group()) print(re.findall("(a)g(b)","adagbgdagbh")) ret = re.search("(?P<id>\d{2}):(?P<name>\w{2})","25:a5") print(ret.group()) #25:a5 print(ret.group("id")) #25 print(ret.group("name")) #a5 Print (the re.search ( " A [BF] C " , " ABCD " ) .group ()) # ABC string Print (the re.findall ( " A [BF] C " , " ABCD " )) # [ ' abc '] list type # | Print (the re.findall ( " a | B " , " afbgh " )) # [ 'a', 'B'] and a need to match all of the B Print (the re.search ( " a | B " , " gaafbghagdbg " ) .group ()) # a only needs to match all of the a and b Print (re.search ( " (ab) | f " , " gaabfbghagdbg " ) .group ()) # ab
Print (re.search (" \ d | gg "," ds125ffgg " ) group ()) # 1.