At 11:00 AM +0000 1/30/02, Michael Davey - Sun UK Support Engineer wrote:
>Now, if I have:
>
>   perl -e '$a="\x23\x41\x23"; $a =~ s/\x41/\x42/; print $a;'
>
>In Java I would do:
>
>   // assume Java \u00NN is equivalent to Perl \xNN
>   input = new PatternMatcherInput ( "\u0023\u0041\u0023" );
>   result = perl.substitute( "s/\\x41/\\x42/", input);
>
>I expect the Perl replacement string (with an extra backslash for
>Java) to be interpreted and for result to hold "#B#".  But I get
>"#x42#", suggesting that \\xNN is parsed in the replacement string.

Do we escape \xNN?

I don't think we do.... since \xNN is a perl hex escape... not a java one.

Would you want to do this:

   input = new PatternMatcherInput ( "\u0023\u0041\u0023" );
   result = perl.substitute( "s/\u0041/\\u0042/", input);

???

mark

-- 
---------------------------------------------------------------------------
  Mark F. Murphy, Director Software Development   <mailto:[EMAIL PROTECTED]>
  Tyrell Software Corp                            <http://www.tyrell.com>
---------------------------------------------------------------------------

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to