From: seebs@... (Peter Seebach) Date: 2007-06-11T23:12:31+09:00 Subject: Re: why gsub! doesn't work in my script In message , Li Chen writes: >Thanks, but the replacement still doesn't work. >It is my understanding that Regexp#escape method should do the magic >work for me. Your understanding makes no sense. When you put a backslash in a string, it is eaten up by the interpreter BEFORE ANY METHODS ARE ACTUALLY CALLED. Regexp#escape gets the string AFTER backslashes have been eaten. So there's nothing there for it to escape. The escape method isn't magic; it can't tell how your source is laid out, only what actual string it is given. -s