Bug 10893 - {n.m} notation work incorrect if n=0
Summary: {n.m} notation work incorrect if n=0
Status: CLOSED DUPLICATE of bug 19329
Alias: None
Product: Regexp
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Jakarta Notifications Mailing List
URL:
Keywords:
: 22035 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-07-17 14:54 UTC by Torres Elio
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Torres Elio 2002-07-17 14:54:26 UTC
the match-method on RE class work incorrectly if the lower bound in the {n,m}
notation have the value of 0 for n and n<m.

I wrote this test programm to check the erro:

import org.apache.regexp.RE;

public class test
{
  public static void main(String args[])
  {
    try
    {
      test re = new test();
      re.test();
    } catch(Exception e)
    {
    }
  }

  public void test()
    throws Exception
  {
    String[] exprV = {"ab{0,1}","ab{1}"};
    String[] matchV = {"a","aa","aba","abba"};
    boolean matched;
    RE r;
    System.out.println("expr \tmatch \tMatches");
    for (int i=0; i<exprV.length;i++) 
    {
        r = new RE(exprV[i]);
	for (int j=0; j<matchV.length; j++)
	{    
	    matched = r.match(matchV[j]);
	    System.out.println(exprV[i]+"\t"+matchV[j]+"\t"+matched);
	}
    } 
  }
}

the result was

expr    match   Matches
ab{0,1} a       false    <--- must be true!
ab{0,1} aa      false    <--- must be true!
ab{0,1} aba     true
ab{0,1} abba    true
ab{1}   a       false
ab{1}   aa      false
ab{1}   aba     true
ab{1}   abba    true

I got these results with Linux and java version 1.3.1_01.
Comment 1 Vadim Gritsenko 2003-04-25 18:19:24 UTC
Fixed by patch attached to bug #19329

*** This bug has been marked as a duplicate of 19329 ***
Comment 2 Vadim Gritsenko 2003-05-02 01:10:15 UTC
Fixed by Bug #19329
Comment 3 Vadim Gritsenko 2003-07-31 23:38:16 UTC
*** Bug 22035 has been marked as a duplicate of this bug. ***