我带来了直到
instance_name(.+)(?=instance_name)
我的测试字符串:
instance_name DEDUP
iops,other,1
instance_name USERSPACE_APPS
iops,read,158534981
iops,write,168514545
iops,other,1557566878
total_latency,read,38774076988
total_latency,write,36596756500
total_latency,other,96023066014
time
它只匹配
DEDUP
iops,other,1
我知道最后没有 instance_name 。但我想匹配 instance_name 之后的所有数据,直到下一个 instance_name。但是对于最后一次出现,最后没有 instance_name。我也想要那个。
我正在使用python。有什么建议么?
编辑
预期输出:
比赛1:
DEDUP
iops,other,1
Match2:
USERSPACE_APPS
iops,read,158534981
iops,write,168514545
iops,other,1557566878
total_latency,read,38774076988
total_latency,write,36596756500
total_latency,other,96023066014