Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with a REGEXP-expression

807580Sep 10 2010 — edited Sep 13 2010
Hello,
I'm coding in java jdk 1.3.1_11, mainly because there won't be an upgrade to a newer version.
The regexp that I'm using is ".*((?i)r(echt)?b(\.|ank)?\s(den\shaag|.{1,3}gravenhage))"*

The code is:
public static void main(String[] args) {
        try {
                String value= "rechtbank den haag";
                org.apache.regexp.RE rexp = new org.apache.regexp.RE(".*((?i)r(echt)?b(\\.|ank)?\\s(den\\shaag|.{1,3}gravenhage))");
                rexp.match(value);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
However when I'm running this program is gives and error:
org.apache.regexp.RESyntaxException: Syntax error: Missing operand to closure
	at org.apache.regexp.RECompiler.syntaxError(Unknown Source)
	at org.apache.regexp.RECompiler.terminal(Unknown Source)
	at org.apache.regexp.RECompiler.closure(Unknown Source)
	at org.apache.regexp.RECompiler.branch(Unknown Source)
	at org.apache.regexp.RECompiler.expr(Unknown Source)
	at org.apache.regexp.RECompiler.terminal(Unknown Source)
	at org.apache.regexp.RECompiler.closure(Unknown Source)
	at org.apache.regexp.RECompiler.branch(Unknown Source)
	at org.apache.regexp.RECompiler.expr(Unknown Source)
	at org.apache.regexp.RECompiler.compile(Unknown Source)
	at org.apache.regexp.RE.<init>(Unknown Source)
	at org.apache.regexp.RE.<init>(Unknown Source)
	at main(test.java:4)
Can anybody help me with this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 11 2010
Added on Sep 10 2010
1 comment
845 views