You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-user@jakarta.apache.org by Böhringer Jochen <Jo...@tcc-products.de> on 2005/02/25 11:30:44 UTC

java.lang.ArrayIndexOutOfBoundsException evaluating regexp

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: 

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 = new RE(".{0,4096}");
        System.out.println("Matches: " + regExp.match("ABC"));
	}
}



Thx
Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-user-help@jakarta.apache.org