Everything's okay. You did the right thing. From the javadocs:
I sincerely apologize. I didn't read the docs.. just assumed matches() would do what Matcher.matches() of jdk1.5 does.

Though I do believe this is a bit non-intuitive. What would be the practical use of having such a method ?


Thanks for making such a great library! Regards, Tarun



Note: matches() is not the same as sticking a ^ in front of your expression and a $ at the end of your expression in Perl5 and using the =~ operator, even though in many cases it will be equivalent. matches() literally looks for an exact match according to the rules of Perl5 expression matching. Therefore, if you have a pattern foo|foot and are matching the input foot it will not produce an exact match. But foot|foo will produce an exact match for either foot or foo. Remember, Perl5 regular expressions do not match the longest possible match. From the perlre manpage:


Alternatives are tried from left to right, so the first
alternative found for which the entire expression matches, is
the one that is chosen. This means that alternatives are not
necessarily greedy. For example: 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.





This e-mail and any files transmitted with it are for the sole use of the intended 
recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and 
destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or 
copying of this email or any action taken in reliance on this e-mail is strictly 
prohibited and may be unlawful.

                Visit us at http://www.cognizant.com


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

Reply via email to