[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/25817] New: gnu.regexp: character range and case insensit
From: |
kaz at maczuka dot gcd dot org |
Subject: |
[Bug classpath/25817] New: gnu.regexp: character range and case insensitive matching |
Date: |
17 Jan 2006 10:32:29 -0000 |
CASE_INSENSITIVE flag does not work well in some case, where
the lower and higher bound of a character range is not alphabetic.
$ cat W.java
import java.util.regex.*;
public class W {
public static void main(String[] args) throws Exception {
int flags = 0;
if (System.getProperty("CASE_INSENSITIVE") != null) {
flags |= Pattern.CASE_INSENSITIVE;
}
Pattern p = Pattern.compile(args[1], flags);
Matcher m = p.matcher(args[0]);
System.out.println(m.matches());
}
}
GNU Classpath:
$ java W 'a' '[?-_]'
false
$ java -DCASE_INSENSITIVE=1 W 'a' '[?-_]'
false
This should be true because '?' <= 'A' <= '_'
Sun's JDK:
$ java W 'a' '[?-_]'
false
$ java -DCASE_INSENSITIVE=1 W 'a' '[?-_]'
true
Perl:
$ perl -e 'print ("a" =~ /[?-_]/ ? "true\n" : "false\n")'
false
$ perl -e 'print ("a" =~ /[?-_]/i ? "true\n" : "false\n")'
true
Ruby:
$ ruby -e 'print ("a" =~ /[?-_]/ ? "true\n" : "false\n")'
false
$ ruby -e 'print ("a" =~ /[?-_]/i ? "true\n" : "false\n")'
true
--
Summary: gnu.regexp: character range and case insensitive
matching
Product: classpath
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kaz at maczuka dot gcd dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25817
- [Bug classpath/25817] New: gnu.regexp: character range and case insensitive matching,
kaz at maczuka dot gcd dot org <=