Hello Daniel, Thursday, December 20, 2001, 3:49:46 AM, you wrote:
>>1.How can I obtain "1212 345345" from "12 345" without changing a pattern? >>2.Why oro doesn't support "$&" expression while it's standard in perl? DFS> $& is not part of Perl regular expression syntax. It is a special Perl DFS> variable that has a special Perl meaning. The .regex package implements DFS> Perl regular expression syntax, not special Perl variables like $&, $`, DFS> etc. It's a subtle difference similar to the reason why \Q isn't there As i am an ordinary stuped user, i don't want to know of any subtle matter. I just plain know that in perl one can use "$&" in a substution, while i can't, and this frustrates me a lot :-))) DFS> (it's part of Perl double quoted string processing). Use capturing DFS> parentheses and $1 instead: DFS> String patt="(\\d+)"; DFS> String sub="$1$1"; DFS> String input="12 345"; IMHO, in discussed situation purity weights much less than convenience. In my case i was to write 4 kb of UUUGLY (mostly backslash issues) code to get the absence of "$&" worked around. Just because the patterns wasn't mine. DFS> daniel Daniel, is it possible to add a support for "$&" to a Perl5Substitution? This could be of real value... And, finally, the real subject. I've done a part of regex testing framework , namely a suit based on perl5.003_07/t/op/re_tests(class junit.regex.Perl5TestSuite). It's a very basic suit, but it runs and gives an excellent result for ORO. What i have got: package - jakarta-oro-2.0.4.jar tests - 274 unexpected errors - 0 ! Failures: 20 ALL failures are of the same type - illegal compilation of zero-with infinite quantifiers(see details below), IMHO we can ignore them all. Congratulations. These tests doesn't include cases for: 1. multiline input 2. state recovery (such as "(A|B)*\1") 3. substitution 4. something else Some input on such cases is very appreciated. And, the last question, where to upload the stuff. Appendix. Output from junit: (OroMatcher is a wrapper for the whole library) java -cp ... junit.regex.oro.OroMatcher ......................................... ..................F..F.F................F.F.F.F. ......F.F.........F......................... ......................................... ................................F..F.F...... ..........F.F.F.F.......F.F.........F........... ............................ Time: 0,39 There were 20 failures: 1) Shouldn't compile: '()*'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 2) Shouldn't compile: '^*'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 3) Shouldn't compile: '$*'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 4) Shouldn't compile: '(a*)*'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 5) Shouldn't compile: '(a*)+'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 6) Shouldn't compile: '(a|)*'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 7) Shouldn't compile: '(a*|b)*'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 8) Shouldn't compile: '(^)*'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 9) Shouldn't compile: '(ab|)*'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 10) Shouldn't compile: '((a*|b))*'null(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 11) Shouldn't compile: '()*'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 12) Shouldn't compile: '^*'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 13) Shouldn't compile: '$*'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 14) Shouldn't compile: '(a*)*'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 15) Shouldn't compile: '(a*)+'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 16) Shouldn't compile: '(a|)*'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 17) Shouldn't compile: '(a*|b)*'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 18) Shouldn't compile: '(^)*'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 19) Shouldn't compile: '(ab|)*'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) 20) Shouldn't compile: '((a*|b))*'i(junit.regex.ShouldNotCompile)junit.framework.AssertionFailedError at junit.regex.RegexTest.checkCompile(RegexTest.java:23) at junit.regex.ShouldNotCompile.runTest(ShouldNotCompile.java:12) at junit.regex.oro.OroMatcher.main(OroMatcher.java:85) FAILURES!!! Tests run: 274, Failures: 20, Errors: 0 Process Exit... -- Best regards, Sergey mailto:[EMAIL PROTECTED] P.S. Merry xmas 2all! -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>