In message <[EMAIL PROTECTED]>, Kayiti Devan
andam writes:
>I am using the jakarta-oro-2.0.5.jar for the validation of Strings with
>respect to the Regular Expression which we provide. In my case, whenever we
>have more than one OR's present in the Regular Expression, it doesn't work
>the way we think. It fails even though the String does maintain the Regular
>Expression Condition.

There are two things you need to do to get help in this matter.  The
first is to upgrade to the latest version (2.0.8).  The second is to
write and submit an example program that isolates and reproduces the problem.

>For example :
>Consecutive ORs in patterns are not handled correctly. The following
>expression:
>\d{3}[.]\d{2}[.]\d{2}|\d{3}[.]\d{2}|\d{3}
>Does not work as it should and throws the error. When you put parenthesis in
>to group the ORs like this: 
>\d{3}[.]\d{2}[.]\d{2}|(\d{3}[.]\d{2}|\d{3}) 
>it works fine.

The two expressions mean different things.  I don't know if you're using
contains or matches, but if you're using matches, read the docs for it
again.  Remember, Perl expressions are greedy by default and match
alternations left to right, stopping on the leftmost match.

>I have seen a similar type bug being present in
>http://issues.apache.org/bugzilla/show_bug.cgi?id=9253
><http://issues.apache.org/bugzilla/show_bug.cgi?id=9253>  for the 2.0.1
>version. I see that opened somewhere in May 2002 and hasn't been yet closed.

That's a Xerces2 bug report.  Also, it's not a bug for Perl but would
be for Awk.  They match differently.  For example, straight from the
Perl perlre man page:
       when matching "foo|foot" against "barefoot", only the "foo"
       part will match, as that is the first alternative tried, and it
       successfully matches the target string.
For Awk, the "foot" part will match because it finds the longest match.

>Do anyone has any idea, whether this has been solved or not, and is there a
>fix available for this in new builds? and if not, is there any workaround,
>since in our cases we can't change change regular expression as such, as we
>do have quite a few schemas for it.

Without a reproducible test case, it's impossible to say whether you're
dealing with a "foo|foot" issue or something else.

daniel


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to