You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by Henning Schmiedehausen <hp...@intermeta.de> on 2002/02/25 12:10:18 UTC

Bug Report and [PATCH] Fix for it

Hi,

consider the following test case (jakarta-regexp-1.3-dev from snapshot
2002-02-24):

--- cut ---
import org.apache.regexp.RE;

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

  public void execute()
    throws Exception
  {
    String expr = "^[\\w\\d\\.\\-]+$";
    String match ="abenteuer-friedhof.de";
    System.out.println("expr:  "+expr);
    System.out.println("match: "+match);
    RE r = new RE(expr);

    boolean matched = r.match(match);

    System.out.println("Matches: "+matched);
  }
}
--- cut ---

Running it produces:

expr:  ^[\w\d\.\-]+$
match: abenteuer-friedhof.de
Matches: false

Which is wrong. The character class contains letters, numbers, the dot
and the hyphen. At least it should.

Bug fix is attached.

	Regards
		Henning


-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20