Bug 15455

Summary: RE unable to match a + character as part of character class
Product: Regexp Reporter: Calvin Goodrich <calvin.goodrich>
Component: OtherAssignee: Jakarta Notifications Mailing List <notifications>
Status: CLOSED DUPLICATE    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Calvin Goodrich 2002-12-17 20:59:27 UTC
The RE object is unable to match a '+' character when it is part of a 
character class, i.e. [\+\-\*\/\%]. It is able to match '-', '*', '/', and '%' 
just fine. It's even broken when the + is specified as an hex char, as in 
[\x2B\x2D\x2A\x2F\x25], whereas the other characters still match.

Tested against JDK v1.3.1_01 and JDK v1.4.1_01 on the Windows platform.

Test JSP code follows:

<%@ page import="org.apache.regexp.*"%>
<%
  String formula = "1 + 1";
  RE re = new RE ("([\\+\\-\\*\\/\\%])");
  if (re.match (formula)) {
%>
expression matched '<%= re.getParen (1) %>'
<%
  }
%>
Comment 1 Vadim Gritsenko 2003-04-25 12:34:24 UTC

*** This bug has been marked as a duplicate of 14954 ***
Comment 2 Vadim Gritsenko 2003-05-02 01:15:07 UTC
Fixed by Bug #19329