[英]RegExp for multiple lines - matching and capturing unique output
* A:DUT-C#顯示統計信息gx
output of above command
* A:DUT-C#顯示統計信息gy
output of above command
* A:Dut-C#顯示狀態s11
output of above command
* A:Dut-C#顯示狀態s12
output of above command
* A:DUT-C#顯示狀態s5
output of above command
* A:DUT-C#顯示狀態s1u
output of above command
* A:DUT-C#
如果我想在一個巨大的文件中搜索上述字符串,然后捕獲每個接口的輸出(gx,gy,s11,s12,s5,s1u等)統計信息,則正則表達式將是什么?
我嘗試了以下正則表達式,但仍不完整:
*/([*A-Za-z]:Dut-[a-zA-Z]{1}#\sshow stats\s(gx|gy|s11|s12|s5|s1u)|[\r])/g*
無法弄清楚該怎么做。
此解決方案有效:
A:Dut-C#\sshow\sstats\s(\w+)[$\s\n]+([=\n:a-zA-Z0-9! \-\.]+\* indicates that the corresponding row element may have been truncated.)
標志:全球
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.