Python regex查找6到7位数之间的所有数字

2024-10-01 19:26:27 发布

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

我使用python中的re module使用此regex,得到以下结果:

In [156]: re.findall(r'.*\D(\d{6,7})\D.*', ' f123456 f1234567 ')
Out[156]: ['1234567']

…但我想要这个结果:

^{pr2}$

我不知道怎么形成这个正则表达式。你能帮忙吗?在


Tags: inreoutregexmodulefindallpr2f1234567

热门问题