Hello Daniel,

Tuesday, May 3, 2005, 10:08:05 PM, you wrote:

Just of pure academic interest, let me to object on the issue.

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

Not convinced yet. I still think there is a bug.
Let's look at the javadoc:

DFS> possible match.  From the perlre manpage:
DFS>    * <blockquote>
DFS>    *   Alternatives are tried from left to right, so the first
DFS>    *   alternative found for which the entire expression matches,
DFS>    *   is the one that is chosen. This means that alternatives
DFS>    *   are not necessarily greedy. For example: when matching
DFS>    *   foo|foot against "barefoot", only the "foo" part will
DFS>    *   match, as that is the first alternative tried, and it
DFS>    *   successfully matches the target string.
DFS>    * </blockquote>

I cannot see where the perlre allows the "foo|foot" not to produce the
exact match against "foot", which takes place in the case in question.
It obviously says about the partial rather than exact match, so
it simply doesn't apply.
I'm not sure if i'm not missing something here.


-- 
Best regards,
 Sergey                            mailto:[EMAIL PROTECTED]



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

Reply via email to