Hello, I have noticed a problem when I use a \U or \u in the replacment part of s/// expression, while using class org.apache.oro.text.perl.Perl5Util, methode String : substitute(java.lang.String expression, java.lang.String input). I had reproduced this problem either on a Win2000 PC and on a AIX 4.3.3. Furthemore, Ii also happen when using ORO 2.0.2 dev 2 When I use write like : >>> Perl5Util PU = new Perl5Util() ; >>> String Res = PU.substitute("s/(.*)/\U$1/","aaa") ; I have got Res == "\Uaaa". This alos happens using the substitueExample delivered : d:\misc >java -classpath .;d:\Misc\oro-2.0.2.jar substituteExample "(.*)" "\U$1" "hello everyone" substitute regex: (.*) result: \Uhello everyone d:\misc >java -classpath .;d:\Misc\oro-2.0.2.jar substituteExample "(.*)" "\u$1" "hello everyone" substitute regex: (.*) result: \uhello everyone If I write and launch a small test.pl, using ActivePerl v5.6.0 on my W2000 >>> $test = "" ; >>> foreach $argument (@ARGV){ >>> $test .= $argument." " ; >>> } >>> print ("Source = ", $test, "\n" ) ; >>> $test =~ s/(.*)/\U$1/g ; >>> print ("Result = ", $test, "\n" ) ; I've got : d:\misc >perl test.pl "hello everyone" Source = hello everyone Result = HELLO EVERYONE Bye, Serge Reboul
This is not a bug. \U, \u, \L, etc. are not part of Perl regular expression syntax. They are part of Perl double quoted string processing and therefore do not fall within the scope of the org.apache.oro.text.regex and org.apache.oro.text.perl packages. If you want to use \U-like functionality in a substitution, implement the Substitution interface and perform your own custom processing.
Reopened bug in order to change its status to fixed since Mark Murphy's recent patch to Perl5Substitution fixes it.
This bug, really a feature request, was resolved in release 2.0.3 with Mark Murphy's Perl5Substitution patch.
Closing bug as the feature addition has been extensively verified in the process of releasing version 2.0.3.