Re: MalformedPatternException seen with OROMatcher regular expression library

"Daniel F. Savarese" <[email protected]> Fri, 27 Aug 2004 10:47:10 -0400
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <[email protected]>
>I am using the OROMatcher regular expression library, which is bundled with
>WebLogic Server. I am using com.oroinc.text.regex.PatternCompiler to=
> compile
>a regular expression. I got the following exception :=0D
>=0D
>"com.oroinc.text.regex.MalformedPatternException: Unreached characters at
>end of expression. Please report this bug!"=0D
>=0D
>The regular expression that I am trying to compile is :=0D
>"/rack=3D([1-9][0-9]|[0-9])(/shelf=3D([1-9][0-9]|[1-9])(/slot=
>=3D([1-9][0-9]|[1-9])
>(/sub_slot=3D([1-9][0-9]|[1-9]))?)?)?"

I cannot reproduce the exception with that pattern using the latest version
of Jakarta ORO.  You should upgrade your code to use Jakarta ORO instead.
It's just a matter of changing your imports.  A utility program called
oroToApache is provided in the tools directory to do that for you.  That
particular exception (with that message) should never be thrown, so there
must have been a bug in the expression parsing code having to do with
parentheses for that version of OROMatcher.  Pat yourself on the back; I've
never heard of it being thrown :)

As an unrelated comment, I'd tweak the expression to replace each of the
([1-9][0-9])|[0-9]) instances with ([1-9]?[0-9]).  Even though they're
equivalent, the second expression evaluates matches faster.

daniel