Users: 'Users:'
\s* whitespace (\n, \r, \t, \f, and " ") (0 or
more times (matching the most amount
possible))
( group and capture to \1:
.*? any character except \n (0 or more times
(matching the least amount possible))
) end of \1
(?= look ahead to see if there is:
\n '\n' (newline)
Groups: 'Groups:'
) end of look-ahead
使用
见proof
结果:
['user1', 'user2']
正则表达式解释
如果您使用P4Python,我假设这是一个Perforce组规范,当您获取一个组时,它会自动将规范解析为一个Python对象,因此不需要正则表达式
相关问题 更多 >
编程相关推荐