[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/24876] Regex failure
From: |
kaz at maczuka dot gcd dot org |
Subject: |
[Bug classpath/24876] Regex failure |
Date: |
22 Jan 2006 03:52:50 -0000 |
------- Comment #5 from kaz at maczuka dot gcd dot org 2006-01-22 03:52 -------
Created an attachment (id=10699)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10699&action=view)
Another testcase
This test shows the following.
GNU Classpath (with Kaffe):
$ java W 'address@hidden' '(.+?)!((.+?)@(.+?))'
false
$ java -DFIND=1 W 'address@hidden' '(.+?)!((.+?)@(.+?))'
true
G0 = address@hidden
G1 = rabbit78_
G2 = address@hidden
G3 = n=roman
G4 = 2
Sun's JDK:
$ java W 'address@hidden' '(.+?)!((.+?)@(.+?))'
true
G0 = address@hidden
G1 = rabbit78_
G2 = address@hidden
G3 = n=roman
G4 = 212.126.219.82
$ java -DFIND=1 W 'address@hidden' '(.+?)!((.+?)@(.+?))'
true
G0 = address@hidden
G1 = rabbit78_
G2 = address@hidden
G3 = n=roman
G4 = 2
Other languages:
Perl:
$ perl -e 'print (("address@hidden" =~ /(.+?)!((.+?)@(.+?))/
? $4 : false)."\n")'
false
Ruby:
$ ruby -e 'print (("address@hidden" =~ /(.+?)!((.+?)@(.+?))/
? $4 : false) + "\n")'
2
The behavior of GNU Classpath resembles Ruby and I think that is the
correct behaviour in the light of the meaning of "+?".
Sun's find() correctly finds "address@hidden" but Sun's matches()
matches "address@hidden" more greedily than expected
for "+?".
I am not sure whether this greedy match of Sun's is correct.
Programmers are not encouraged to use such ambiguous expression
whose meaning depends on the implementation.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24876
- [Bug classpath/24876] Regex failure,
kaz at maczuka dot gcd dot org <=
- [Bug classpath/24876] Regex failure, kaz at maczuka dot gcd dot org, 2006/01/22
- [Bug classpath/24876] Regex failure, cvs-commit at developer dot classpath dot org, 2006/01/30
- [Bug classpath/24876] Regex failure, kaz at maczuka dot gcd dot org, 2006/01/30
- [Bug classpath/24876] Regex failure, kaz at maczuka dot gcd dot org, 2006/01/30
- [Bug classpath/24876] Regex failure, pinskia at gcc dot gnu dot org, 2006/01/31