DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10893>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10893

{n.m} notation work incorrect if n=0

           Summary: {n.m} notation work incorrect if n=0
           Product: Regexp
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Other
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to