Bug 22802 - java.util.regex.Pattern doesn't handle parens in character sets consistently
Summary: java.util.regex.Pattern doesn't handle parens in character sets consistently
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: 0.90
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-25 18:18 UTC by from-classpath
Modified: 2006-01-28 21:20 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description from-classpath 2004-11-25 18:18:20 UTC
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)

Comment 1 cvs-commit@developer.classpath.org 2006-01-12 22:31:28 UTC
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



Comment 2 Ito Kazumitsu 2006-01-12 23:17:55 UTC
Fixed.