[plt-scheme] Odd behavior in regexp-replace (299.25-cvs4jan2005)

From: Richard Cobbe (cobbe at ccs.neu.edu)
Date: Tue Jan 4 17:57:39 EST 2005

Welcome to MzScheme version 299.25, Copyright (c) 2005 PLT Scheme, Inc.
> (printf "~a~n" (regexp-replace ">>" "abc>>def" "\\red{}"))
abc>>red{}def
> (printf "~a~n" (regexp-replace ">>" "abc>>def" "\\\\red{}"))
abc\red{}def

I don't understand this -- why should I have to escape the backslash in
order to ensure that the >> is removed from the original string?  Or is
this a bug in regexp-replace that interprets "\\red{}" as though it were
"\\0red{}"?

In either case, the observed behavior doesn't match (my interpretation
of) the documentation.

Thanks,

Richard



Posted on the users mailing list.