jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10893] New: - {n.m} notation work incorrect if n=0
Date Wed, 17 Jul 2002 14:54:27 GMT
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: regexp-dev@jakarta.apache.org
        ReportedBy: torres@fokus.fhg.de


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:regexp-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:regexp-dev-help@jakarta.apache.org>


Mime
View raw message