In message <[EMAIL PROTECTED]>, Kayiti Devan
andam writes:
>Please do find attached the test case for it. (testRegEx.java which can be
>compiled with putting "jakarta-oro-2.0.8.jar" in the classpath.)
>With both the 2.0.5 and 2.0.8 versions I am finding the following results:
>
>For the stringPattern -->> \d{3}|\d{3}(.)\d{2}
>       123 -> Passed
>       123.46 Failed (which shouldn't fail)

That's a different pattern than the one you originally posted.  Since
I now can see from your test case that you are using matches(), I can
tell you the problem is exactly the foo|foot scenario I mentioned.  It
is explained in the documentation for Perl5Matcher.matches.  There is
no bug.  You should use either
  \d{3}(.)\d{2}|\d{3} (although I suspect you mean \d{3}\.\d{2}|\d{3})
or
 ^(?:\d{3}|\d{3}(.)\d{2})$
or
 \d{3}(?:(.)\d{2})?

The simplest thing to do when using matches() if you either don't
understand the foo|foot scenario and how Perl expressions match with
respect to alternations or if you have a complicated expression, is
to simply stick the expression inside of ^(?:)$, turning foo|foot
into ^(?:foo|foot)$

daniel


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

Reply via email to