OK, great, thanks. I also had the idea to write a JDK 1.4-specific
subclass of the test class and place my format checks in there. Since
the code I know is generic across JDKs I would have been satisfied. But
I think your approach with jakarta-oro sounds better!
David
Andrew McIntyre wrote:
On 7/22/05, David Van Couvering <[EMAIL PROTECTED]> wrote:
Thanks, Andrew. I was trying to add some functionality to look for a
pattern in a string, using java.util.regex. In general this test is
intended to be run in JDK 1.3, and potentially (I'm not sure) in J2ME.
So, am I not allowed to use 1.4 features in these "generic" tests that
are intended for use across JVMs? Sounds like it... Sigh...
Well, I won't stop you from using 1.4 features in your tests, but I
suspect you may have a rather difficult time getting them to run
properly in JDK 1.3 or J2ME. ;-)
Here's the good news: we already require that the jakarta-oro classes
be available to run the tests. It would be the first instance that I
know of a test using the oro classes and not just the test harness,
but they're there and they do pattern matching.
Intead of:
Pattern.matches("my(reg|ex)", charsequence);
import org.apache.oro.text.perl.Perl5Util, and do:
Perl5Util p5u = new Perl5Util();
Perl5Util.matches("my(reg|ex)", "myinputstring");
Javadoc is available online:
http://jakarta.apache.org/oro/api/
cheers,
andrew