[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 22:30:48 -0000 |
------- Comment #6 from kaz at maczuka dot gcd dot org 2006-01-22 22:30 -------
omment #5 says: > 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. I now think JDK's behavour is correct. "+?" means "not so greedy but
requiring the necessary minimum". In order to match the whole string against
the regexp, the last ".+?" must match "212.126.219.82". In fact, GNU
Classpath's implementation works correctly in the following case: $ java W
'address@hidden' '(.+?)!((.+?)@(.+?))$' true G0 =
address@hidden G1 = rabbit78_ G2 = address@hidden G3
= n=roman G4 = 212.126.219.82 Yes, In order to match the whole string against
the regexp, the last ".+?" must match "212.126.219.82". The difficult point is
that the same regexp "(.+?)!((.+?)@(.+?))" must behave differently depending on
whether it is used with find() or match(). In the latter case, it must be
treated as if it were "(.+?)!((.+?)@(.+?))$".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24876