小编Raj*_*hak的帖子

正则表达式匹配任何大于 5 的数字

我需要匹配大于 5 的失败计数。

string="""fail_count 7

fail_count 8

fail_count 9

fail count 7

fail_count 71

fail_count 23
"""

match = re.search(r'fail(\s|\_)count\s[5-9]', string)

if match:

    print match.group()
Run Code Online (Sandbox Code Playgroud)

我最多可以匹配 9,但是如果我将范围增加到 999,它就不起作用。

regex python-2.7

0
推荐指数
1
解决办法
4249
查看次数

标签 统计

python-2.7 ×1

regex ×1