replace(s, "a", "\b");
(3) Result: "foo.b\br.com"
In the last case you're actually specifying a valid -escape (BEL).
\b is not BEL. \a is BEL. \b is BS.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2004-09-09 14:47: Subject: Bug in replace
Replace doesn't seem to like . :
It seems you're confused; \ is the string escape character. replace will never see the \ in the string ".", since it is equvivalent to the string ".".
string s = Pike v7.6 release 13 running Hilfe v3.5 (Incremental Pike Frontend)
string s = "foo.bar.com"; replace(s, ".", ".");
(1) Result: "foo.bar.com"
replace(s, "a", ".");
(2) Result: "foo.b.r.com"
replace(s, "a", "\b");
(3) Result: "foo.b\br.com"
In the last case you're actually specifying a valid -escape (BEL).
It does the same with 7.2, 7.4
As it should.
/ Henrik Grubbström (Lysator)