Bug 1394 - method Perl5Util.substitue : Pb with \u or \U s/// like expression
Summary: method Perl5Util.substitue : Pb with \u or \U s/// like expression
Status: CLOSED FIXED
Alias: None
Product: ORO
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.0.1
Hardware: All All
: P1 normal (vote)
Target Milestone: ---
Assignee: Jakarta Notifications Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-04-19 06:56 UTC by Serge Reboul
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serge Reboul 2001-04-19 06:56:56 UTC
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
Comment 1 Daniel F. Savarese 2001-04-19 19:41:47 UTC
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.
Comment 2 Daniel F. Savarese 2001-06-08 14:01:07 UTC
Reopened bug in order to change its status to fixed since Mark Murphy's recent
patch to Perl5Substitution fixes it.
Comment 3 Daniel F. Savarese 2001-06-08 14:02:08 UTC
This bug, really a feature request, was resolved in release 2.0.3 with Mark
Murphy's Perl5Substitution patch.
Comment 4 Daniel F. Savarese 2001-06-08 14:03:05 UTC
Closing bug as the feature addition has been extensively verified in the
process of releasing version 2.0.3.