java.lang.ArrayIndexOutOfBoundsException evaluating regexp

Böhringer Jochen <[email protected]> Fri, 25 Feb 2005 11:30:44 +0100
Newsgroups gmane.comp.jakarta.regexp.user
Message-ID <[email protected]>
Hi,

we use the regexp package version 1.3 in our webapplication to validate =
user inputs. One user input field has a max length of 4096 characters.
So the following regexp is used: .{0,4096}
and leads to this exception:=20

java.lang.ArrayIndexOutOfBoundsException: -16381
	at org.apache.regexp.RE.matchNodes(Unknown Source)
	at org.apache.regexp.RE.matchAt(Unknown Source)
	at org.apache.regexp.RE.match(Unknown Source)
	at org.apache.regexp.RE.match(Unknown Source)
	at org.apache.regexp.RE.match(Unknown Source)
	at de.tcc_products.test.RegExpTester.main(RegExpTester.java:10)

If I split up the regexp in a semantically similar regexp: =
(.{0,128}){0,32}

everything works fine.

Is this a bug or is something wrong with the regexp?

This code snippet can be used to reproduce the error:

package de.tcc_products.test;

import org.apache.regexp.RE;

public class RegExpTester
{
	public static void main(String[] args)
	{
        RE regExp =3D new RE(".{0,4096}");
        System.out.println("Matches: " + regExp.match("ABC"));
	}
}



Thx
Jochen