Hi,

I'm trying to substitute all occureances of "." (dot) in the input string with "\.". 
I'm using jakarta-oro-2.0.8 and the code looks like this:

param = org.apache.oro.text.regex.Util.substitute(new 
org.apache.oro.text.regex.Perl5Matcher(), "([.])", new 
org.apache.oro.text.regex.Perl5Substitution("\\$1"), param, 
org.apache.oro.text.regex.Util.SUBSTITUTE_ALL);

I'm running a program containing the above line on both windows and solaris (from the 
command line and in an application server environment - WebLogic7), and the result of 
substitution is different, depending on the environment. On windows, both when 
executed from the command line and in the app server, it produces "$1" in place of "." 
(e.g. if param equals "test.test" the reult is "test$1test"), the same is on solaris 
in case of commad line execution. When executed in the app server on solaris, it 
produces, what I intend it to do, "\." ("test.test" on input produces "test\.test").  
When I changed the substitution pattern to "\\\\$1" the result in the first case was 
"\." (correct) but in the app server on solaris it gave "\\." It looks as if the 
library differently interpreted "\\$" : once as the "$" sign itself, and once as "\$" 
sequence. 

Does anyone know what migth be the reson of the above behaviour?

Marcin

Reply via email to