Hi, Schamil,
replacement of "\\1" to "\1" does not work because:
1) I have tried that and it produced a replace string like: "?ricot" with symbol with 
ASCII code 1, as it supposed to be.
2) If RE understands "\\1" in the 2nd example in search string, then it was done OK 
and should work in the 1st example. 

These are examples from my 1st letter:
Example1 
(in replace - does not work):
new RE( "(..)ple").subst ( "Apple is tasty", "\\1ricot");
Returns:             "\1ricot is tasty"
My expectation:   "Apricot is tasty"

Example2 
(in search - does work):
new RE( "(.)=\\1").subst ( "0=0 is correct", "1=1");
Returns:             "1=1 is correct"

Cheers,
Val.

----- Original Message ----- 
From: "Schamil Wackenhut" <[EMAIL PROTECTED]>
To: "Regexp Users List" <[EMAIL PROTECTED]>; "Val Starovoitov" <[EMAIL PROTECTED]>
Sent: Thursday, June 05, 2003 18:11
Subject: Re: Replacing with backrefs does not work, can anybody explain why?


> * Val Starovoitov meinte:
> 
> > new RE( "(..)ple").subst ( "Apple is tasty", "\\1ricot");
> > Returns:             "\1ricot is tasty"
> > My expectation:   "Apricot is tasty"
> 
> Try \1ricot. The problem is you escape the second backslash
> instead of 1.
> -- 
> /earth: file system full.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Reply via email to