*A:Dut-C# show stats gx
output of above command
*A:Dut-C# show stats gy
output of above command
*A:Dut-C# show stats s11
output of above command
*A:Dut-C# show stats s12
output of above command
*A:Dut-C# show stats s5
output of above command
*A:Dut-C# show stats s1u
output of above command
*A:Dut-C#
What will be the regular expression if I want to search for the above strings in a huge file and then capture output of each interface (gx,gy,s11,s12,s5,s1u, etc.) stats?
I tried following regex but it is still not complete:
*/([*A-Za-z]:Dut-[a-zA-Z]{1}#\sshow stats\s(gx|gy|s11|s12|s5|s1u)|[\r])/g*
Couldn't figure out how to do this.
This solution worked :
A:Dut-C#\sshow\sstats\s(\w+)[$\s\n]+([=\n:a-zA-Z0-9! \-\.]+\* indicates that the corresponding row element may have been truncated.)
flags : global
Your pattern seems to work. You need to look in group 1 to find the captured string.
Here is an alternative solution:
a:dut-\\w#\\sshow\\sstats\\s(\\w+)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.