Hi,

Thanks much for the help. It works perfect with the expression you
provided.

Cheers,
Sarika

> -----Original Message-----
> From: Celestino Bellone [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, June 26, 2003 2:17 PM
> To: Regexp Users List
> Subject: Re: Regexp for PING success/failure
> 
> 
> try this...
> 
> String patternRegexp = ".*Success rate is (\\d+) percent
> \\((\\d+)\\/(\\d+)\\)(($)|(,\\s+round-trip\\s+min\\/avg\\/max\
> \s+=\\s+(\\d+)
> \\/(\\d+)\\/(\\d+) ms))";
> 
> I've tried whith two strings:
> 
> "Success rate is 100 percent (5/5), round-trip min/avg/max = 
> 16/21/36 ms" and "Success rate is 100 percent (5/5)"
> 
> 
> It seems to work properly... ;-)
> 
> obviously I've "escaped" the "special characters"
> 
> bye
> Celestino
> 
> 
> ----- Original Message -----
> From: Sarika Inamdar
> To: 'Regexp Users List'
> Sent: Thursday, June 26, 2003 7:02 AM
> Subject: Regexp for PING success/failure
> 
> 
> Hi All,
> 
> We have to come out with the regular expression which will 
> see the ping output and extract ping.percent, packets sent, 
> packets received, and round trip min/avg/max values.
> 
> Ping output is either one of the 2 :
> 
> Success:
> --------
> Type escape sequence to abort.
> Sending 5, 100-byte ICMP Echos to 10.77.11.24, timeout is 2 
> seconds: !!!!! Success rate is 100 percent (5/5), round-trip 
> min/avg/max = 16/21/36 ms
> 
> 
> Failure:
> --------
> Type escape sequence to abort.
> Sending 5, 100-byte ICMP Echos to 192.135.241.26, timeout is 
> 2 seconds: ..... Success rate is 0 percent (0/5)
> 
> The whole output is taken in a String. We have to use a 
> single regular expression which will match both the above cases.
> 
> We have come out with the following regexp, but its not 
> working for the fail case.
> 
> String patternRegexp = ".*Success rate is (\d+) percent 
> \((\d+)\/(\d+)\)[$|,\s+round-trip\s+min\/avg\/max\s+=\s+(\d+)\
> /(\d+)\\/(
> \d+) ms]";
> 
> For the success ping case,it only gives percent complete and 
> packets received and send. Does not give round trip details.
> 
> Any help to resolve this problem would be greatly appreciated.
> 
> Thanks in Advance,
> Sarika
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to