元组中的第一个字符串将由关于芬德尔()总是最长的匹配字符串?

2024-09-27 18:20:25 发布

您现在位置:Python中文网/ 问答频道 /正文

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.')

给了我

^{pr2}$

在本例中,每个元组的第一个字符串最长。总是这样吗?如果有人知道每个元组中其他字符串的来源,我也很想知道!谢谢!在


Tags: andof字符串re元组lototherreporting
1条回答
网友
1楼 · 发布于 2024-09-27 18:20:25

Will that always be the case?

不,从来不是这样。匹配项从从左到右返回到。在

^{}

The string is scanned left-to-right, and matches are returned in the order found

相关问题 更多 >

    热门问题