I am new to scripting and have read about how to use regular expressions.
I want to get the full string matching the pattern.
my ouptut:
64 bytes from 33.33.33.33: icmp_seq=9 ttl=254 time=1.011 ms
--- 33.33.33.33 ping statistics ---
10 packets transmitted, 10 packets received, 0.00% packet loss
I tried writing a regular expression comparing packet loss and tried to get the full string, but could not get it to work.
can someone help me ..
cmd = re.search('(\d*)% packet loss', ping_result[int(i)], re.M|re.I)
print cmd.group()
But this conclusion is only printed
00% packet loss
00% packet loss
source
share