You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-user@jakarta.apache.org by "Shishir K. Singh" <sk...@synapsistech.com> on 2003/06/23 15:55:53 UTC

Regex problem - Pls Help


>  -----Original Message-----
> From: 	Shishir K. Singh  
> Sent:	Monday, June 23, 2003 9:54 AM
> To:	'regexp-user-info@jakarta.apache.org'
> Subject:	Regex problem - Pls Help
> 
> Hi, 
> 
> I am getting a runtime error for a regex pattern. However, when I use the same string  with Java's 1.4 java.util.regex, it works fine....and I can't use Java 1.4 :(. 
> 
>  Is there something that I am missing with this pattern?? 
> 
> 
> RE detail = new RE("^(.*?)\\s*?=\\s*?(.*?)\\;$");
> 
> 
> gives a runtime error :
> 
> 
> java.lang.ArrayIndexOutOfBoundsException: 65584
>         at org.apache.regexp.RECompiler.setNextOfEnd(RECompiler.java:207)
>         at org.apache.regexp.RECompiler.branch(RECompiler.java:1160)
>         at org.apache.regexp.RECompiler.expr(RECompiler.java:1203)
>         at org.apache.regexp.RECompiler.compile(RECompiler.java:1281)
>         at org.apache.regexp.RE.<init>(RE.java:495)
>         at org.apache.regexp.RE.<init>(RE.java:480)
> 
> 
> The intent is to parse a property file like 
> 
> XXXXXX =    "YYYYYY";
> 
> 
> TIA
> Shishir

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-user-help@jakarta.apache.org


RE: Regexp for PING success/failure

Posted by Sarika Inamdar <si...@cisco.com>.
Hi,

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

Cheers,
Sarika

> -----Original Message-----
> From: Celestino Bellone [mailto:celbel@sda.it] 
> 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: regexp-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: regexp-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: regexp-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: regexp-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-user-help@jakarta.apache.org


Re: Regexp for PING success/failure

Posted by Celestino Bellone <ce...@sda.it>.
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: regexp-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-user-help@jakarta.apache.org


Regexp for PING success/failure

Posted by Sarika Inamdar <si...@cisco.com>.
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: regexp-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-user-help@jakarta.apache.org