Pattern.compile("[(]") works and matches a single open paren, but Pattern.compile("([(])") doesn't, nor does Pattern.compile("(?:[(])"). I'm not sure whether parens in character sets need to be escaped, but either way the current behavior is inconsistent. A workaround is to extract the paren from the character set and use something like (?:[abc]|() instead. % gcj --version gcj (GCC) 4.0.0 20041125 (experimental)
Subject: Bug 22802 CVSROOT: /cvsroot/classpath Module name: classpath Branch: Changes by: Ito Kazumitsu <itokaz@savannah.gnu.org> 06/01/12 22:13:49 Modified files: . : ChangeLog gnu/regexp : RE.java Log message: 2006-01-12 Ito Kazumitsu <kaz@maczuka.gcd.org> Fixes bug #22802 * gnu/regexp/RE.java(initialize): Fixed the parsing of character classes within a subexpression. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6035&tr2=1.6036&r1=text&r2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/regexp/RE.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
Fixed.