- 已关闭**。此问题需要超过focused。当前不接受答案。
- 想要改进此问题吗?**更新此问题,使其仅关注editing this post的一个问题。
15小时前关门了。
Improve this question
我希望你能帮助我。我有以下单线:
Total number of commands sent: <number_commands> : number_commands=6 Total number of Special commands sent: <number_commands> : number_commands=0 Total number of unknown commands: <number_commands> : number_commands=0 Total number of command parsing errors: <number_errors> : number_errors=1 Total number of fatal parsing errors: <number_errors> : number_errors=2
Total number of calls made to PROCESS1: <number_calls> : number_calls=0 Total number of calls made with time-out: <number_calls> : number_calls=7 Total number of calls ack by the PROCESS1: <number_calls> : number_calls=0 Total number of calls nack post-poned by the PROCESS1: <number_calls> : number_calls=5 Total number of calls nack rejected by the PROCESS1: <number_calls> : number_calls=5
我需要把错误数、未知命令数和nack数相加,从我的例子中,最终结果应该是:
tot_nack = 10(应仅对字nack之后的number_calls求和)
tot_timeout = 7(它应该只对单词timeout之后的number_calls求和)
错误总数= 3
1条答案
按热度按时间6uxekuva1#
您可以使用
(?=nack)(?:.*?number_calls=)(\d+?)
、(?=time-out)(?:.*?number_calls=)(\d+?)
和(?:number_errors=)(\d+?)
,匹配并获取捕获组#1。