re.findall(r'((([0-9]|[a-z]|[A-Z]){5,8}, )*([0-9]|[a-z]|[A-Z]){5,8} reporting and syncing)', 'johnny, joda89 reporting and syncing heyff, jkojo, jkjkjdf, 2378a reporting and syncing and a lot of other jazz. I looked into whether 34987, 22187, and 36547 will report, but no one has gotten back with me about that. Also 34298 reporting and syncing.')
给了我
[('johnny, joda89 reporting and syncing', 'johnny, ', 'y', '9'), ('heyff, jkojo, jkjkjdf, 2378a reporting and syncing', 'jkjkjdf, ', 'f', 'a'), ('34298 reporting and syncing', '', '', '8')]
在此示例中,每个元组的第一个字符串是最长的。总是这样吗?如果有人知道每个元组中的其他字符串来自哪里,我也很想知道它!谢谢!